Title: Computer Modeling with Agents
1Computer Modeling with Agents
Dave Elliman
2Traditional Science and Engineering
- Considered physical properties
- Natural laws modelled with maths
- Examples please
- Some systems turned out to follow statistical
laws - Some turned out to exhibit unpredictability due
to quantum effects
3Some things could not be predicted by this
approach
Why Not?
4The Stock Market?
5Why such extreme events
- Coherence all particles in the same state
- Ising Model for ferromagnetism modelled this
molecules on a lattice
6The Physics may still be simple BUT
- There are a very large number of interacting
particles - The number of possible states is astronomical
- How can we know the state?
- Sometimes coherence emerges and dramatic
behaviours occur - Sometimes we do Curie effect, Phase changes etc.
7Science is still challenged by complex phenomena
8Think about the particles
- Are they all the same?
- How do they interact?
- What states can the be in?
- What external effects influence the state of the
system? - We can model typical behaviours but this is not
the same as prediction
9(No Transcript)
10Some macroscopic effects in complex systems
- Power law distributions of observable phenomena
- size of earthquake
- Size of market moevement
- After a catastrophe
- Power law decay modulated by periodic function of
increasing wavelength
11Sornettes Compression! (S P 500)
Nearly 3 years
12What about an epidemic?
- People are exposed
- Some get infected
- They pass the disease to others
- They get ill and may die
- If they survive they are immune
- What happens over time?
13We could do an agent model
- People have differing immunity
- People have a varying number of contacts
14Statistical Model
- Average immunity
- Standard Deviation of Immunity
- Make 1000 people or 10000000
- I mean agents
- How do they meet?
15Small World Network
Mean chance of death StdDev of death
Mean chance of transmission StdDev of transmission
16Networks Small-world Lattice
- Small world, with k expected links
- Expected links to neighbors with distance up to
k/2 kp - Connected to k/2-far neighbors with probability p
- Expected long distance links k(1-p)
- Connected to others with k(1-p)/(N-k)
17Networks Scale Free
- The number of links has a power law distribution
- CHARACTERISTIC of COMPLEX phenomena
18What would we discover?
- The infection rate over time
- How many would die
19(No Transcript)
20A typical simulation
21SARS Reported Cases, Taiwan
22Why does this work so well as a model?
- Because WE KNOW THE STATE.
- At the start nobody is infected
- Not true for earthquakes or the stock market
23Modeling the Stock Market - GCMG
- There are a number of traders N
- Each has a number of strategies S
- Trading proceeds for T time periods
- The success of each strategy is monitored over a
period of time W - This implies limited rationality
- At each time step a trader will trade if his
confidence in his best strategy gt ?
24The GCMG Produces amazingly plausible time series
for market returns
I pinched this from Gilles Daniel at Manchester
25What decides the market return?
- The difference between the number of buyers and
sellers - This might be normalised to agree with real
market volatility
26What decides volume
- The number of traders trading at any time step
- Might be normalised to agree with real average
volume
27What other parameters are there?
- The threshold of confidence necessary before a
trader will trade with his best rule - I used 0.53
- The number of strategies and stuff
- A power of 2 is convenient, I used 23 8
- 151 traders why an odd number?
- 500 time steps
- 30 - memory window size
28What is a strategy?
- It is a mapping from a small time window to buy
or sell with a certain confidence level - Using 3 bits
- 0,0,0 ? buy(cf 0.6)
- 0,0,1 ?sell(cf 0.7)
- 0,1,0 ? buy(cf 0.3)
- Assignment to buy or sell is random
- cf changes with time over window
29So how does a Trader know what he will do?
- Which strategy applies?
- He looks at the small time window of the last M
days - Up down down 1,0,0
- Is his cf for this strategy gt 0.53
- If YES Buy or sell whatever it says
- Else pass
- Could have more than two strategy for 1,0,0 but
I only gave one
30Which strategies succeed?
- Those in the minority
- Gives lots of feedback in system
- I dont get it!
- Imagine minority pile in first
- If mostly buying price goes up sellers win
- If mostly selling price goes down buyers get a
bargain - OK?
31So how do we reward success
- If a strategy was successful at a certain time t
- Set its record for that day to 1
- Otherwise set to 0
- Then sum them over the window (30 days I used)
and divide by 30.0 - 0.5 means right half the time
- 0.53 means a bit better than that
32We have plausible behaviour
- How can we synchronise state with a real market?
- Tried using real market feedback some success
- Ask traders?
- Try many examples (TOO MANY!)
33Can we synchronise our model to real market data?
Yes! It works some of the time.
34The model predicts direction, and is more often
right than wrong
Take the best 10 of days and the model gives
odds of 5545 in your favour
35A More Realistic Model
- Some degree of herding added
- A more sophisticates market model
- A more sophisticated trading models
- A more sophisticated pricing model
- Still have the sync problem
- Now also have the curse of dimensionality
36All these parameters is a big disadvantage.
Octave Levenspiel says Give me four parameters
and I will model and elephant.
37The more complex model did improve the prediction
- Markets sometime have a (perhaps small)
deterministic component - An agent model seems to capture some part of the
internal market state - Prices move fastest when there is evidence of
herding - Discovering real market state is the main
difficulty
38More general agent models
- Agents have state and behaviour usually assigned
randomly from a normal distribution - Agents communicate with other agents
- All others
- Those close by
- Small world Model
- We get information about statistical
distributions from such models. Only with luck
real predictions
39Mobile Agents
- Agents might move from machine to machine -
Mobile agents (or Worms) - Agents may wander round the internet Often
called robots eg Google. - Agents may self-replicate often called viruses
- Agents may hide themselves often called Trojans
40So we might use a community of Agents to
- Model and so predict behaviour of a complex
system - Find a bargain on the Internet
- Negotiate a deal or Trade for us (legal issues)
- To find information (to spy)
- To wage war (destroy a computer systems or
e-commerce site)
41Agents with Physical form?
- Of course called Robots
- Mobile phones will soon be be MSL great for
robots! - US Army aims to carry out 30 of offensive
operations using robotic agents by 2012 - Revenge of the machines? New life form?
- They will probably be better traders than people
emotions get in the way.
42Conclusions
- Agent-based simulations are one of the best ways
of modelling complex systems - The suffer from too many parameters (huge search
space) and - Synchronization with real world state is unsolved
43The Future?
- Agents will do most of our work
- When given physical form they
- Will fight and die for us
- Take over the world (?)