What to do with ABMs • We looked at example ABMs • We then tried extending models we already had • We then proceeded to build an ABM from scratch • The wolf-sheep simple model • Next we discussed the main components of an ABM • Agents, environment, interactions, observer and schedule • So, what is the purpose of building an ABM? • To study it and gain new insights on emergent properties!
Master of Business Analytics 17 October 2020 2
Analyzing Agent Based Models • Case study: disease spread • Best known model – the SIR model • Susceptible – those in population who are not yet infected! • Infected – those who are currently infected • Removed – those who recovered or died • An important parameter is r0 • The number that the disease infects before the person infecting recovers • e.g. if r0 is 5, in 3 steps 156 are infected (how?)
Master of Business Analytics 17 October 2020 3
Case study: disease spread • This assumes unlimited population to be infected • Usually the case at the onset of a disease • At some point this number will tail off owing to not having enough hosts to infect • Not unlike what happens in pyramid schemes which require unlimited numbers of gullible individuals! • Other possible complications • No uniform mixing among infected, different susceptibilities to disease, environmental interactions (?)
Master of Business Analytics 17 October 2020 4
Case study: disease spread (contd.) • Check the spread of disease example in the IABM library • Run as is to see typical ‘S’ curve of most ‘adoption’ models
Master of Business Analytics 17 October 2020 5
Case study: disease spread (contd.) • Note the 3 variants implemented • Mobile agents – the base model where agents move randomly • Networked agents – a model that incorporates the fact that individuals interact with others in their ‘circles’ (controlled by the connections per node parameter) • Environmental model – a model that incorporates the agency of the environment it spreading the disease (controlled by the disease decay parameter)
Master of Business Analytics 17 October 2020 6
Case study: disease spread (contd.) • Will the model run the same each time? • i.e. the number of ticks for all to be infected be the same? • Try it! Set the speed to fast to save time! • How can we investigate how population density affects disease spread? • We do multiple runs and check time to 100% infection
Master of Business Analytics 17 October 2020 7
Case study: disease spread (contd.) • It’s a feature – not a bug! • These processes are deliberately stochastic • So, running a simulation multiple times is a requirement • Different ways to do this in NetLogo What does this do?
• Implement within the code repeat 10 [
set num-people 50 • Run it from the command setup while [ count turtles with center ‘observer’ prompt [ not infected? ] > 0 ] [ go ] print ticks • Use the BehaviorSpace ]
module under the Tools menu
• The preferred way!
Master of Business Analytics 17 October 2020 8
Case study: disease spread (contd.) • BehaviourSpace experiments • Need to name the experiment • All variables that can be varied automatically show up • Allows the setting up of the number of repetitions • Need to specify what to report • Name the procedures to run • Can specify timeout if needed
Master of Business Analytics 17 October 2020 9
Case study: disease spread (contd.) • 4 experiments are already setup • Population density – changing the number of people • Degree – changing the number of connections per person (in the network model) • Environmental – changing the length of time the disease can stay on surfaces or the air (environmental model) • Density and decay – changing two variables together (which model?)
Master of Business Analytics 17 October 2020 10
Case study: Population density experiment • Population density experiment – output (csv file)
Try it yourself
Master of Business Analytics 17 October 2020 11
Case study: Population density experiment • Summary (descriptive) statistics • Do in excel itself? • Use R • Use Python/Matplotlib • Visualizing the data • A pic is worth 1000 words! • All the data • Summary data
Master of Business Analytics 17 October 2020 12
Case study: Population density experiment • Can also visualize time series data • Not just the end of run • ABMs keep transitionary data – again all and summary data
Master of Business Analytics 17 October 2020 13
Case study: Environmental experiment • Changing the environment • Spread from environment too • Varying the disease decay variable • As before output to csv file
Master of Business Analytics 17 October 2020 14
Case study: Network experiment • Changing the interactions • Spread from friends and colleagues – not random • 100% infection not guaranteed • Use # infected at timeout
Master of Business Analytics 17 October 2020 15
Case study: Multivariate experiment • So far we varied ONE variable at a time • What if we want to vary more than one? • We need to: 1. Establish base settings and vary from that 2. Aggregate over all other variables 3. 3D Charts of combinations 4. Use regression to fit a model
Master of Business Analytics 17 October 2020 16
Case study: Multivariate experiment (contd.) • Changing density & decay • Change each for all the values of the other • Why 440 runs?
Master of Business Analytics 17 October 2020 17
Case study: Multivariate experiment (contd.) • Changing density & decay – modeling with regression • If the model is really complex we can regress our output variable on all of our inputs • This gives us a sense of how critical each input is to driving the output – and check for interactions
Master of Business Analytics 17 October 2020 18
Homework • Do the descriptive statistics • And the visualizations (all data and error bars) • 3D visualization for multivariate case • Regression model