851 0585 04 L Modeling and Simulating Social
- Slides: 51
851 -0585 -04 L – Modeling and Simulating Social Systems with MATLAB Lecture 3 – Dynamical Systems Karsten Donnay and Stefano Balietti Chair of Sociology, in particular of Modeling and Simulation © ETH Zürich | 2012 -10 -08
Schedule of the course Introduction to MATLAB 24. 09. 01. 10. 08. 10. 15. 10. 22. 10. 29. 10. Working on projects (seminar thesis) 05. 11. 12. 11. 19. 11. Introduction to social-science modeling and simulations 26. 11. 03. 12. 10. 12. 17. 12. 2012 -10 -08 Handing in seminar thesis and giving a presentation K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 2
Schedule of the course Introduction to MATLAB 24. 09. 01. 10. 08. 10. Create and Submit a Research Plan 15. 10. 22. 10. 29. 10. Working on projects (seminar thesis) 05. 11. 12. 11. 19. 11. Introduction to social-science modeling and simulations 26. 11. 03. 12. 10. 12. 17. 12. 2012 -10 -08 Handing in seminar thesis and giving a presentation K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 3
Goals of Lecture 3: students will 1. Consolidate knowledge acquired during lecture 2, through brief repetition of the main points and revision of the exercises. 2. Understand fully the importance and the role of a Research Plan and its main standard components. 3. Learn the basic definition of Dynamical Systems and Differential Equations. 4. Implement Dynamical System in MATLAB a series of examples from Physics and Social Science Literature (Pendulum, Lorenz attractor, Lotka-Volterra equations, Epidemics: Kermack-Mc. Kendrick model) 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 4
Repetition § § § plot(), loglog(), semilogy(), semilogx() § Log-scale plots reduce the complexity of some functional forms and fit well to draw large range of values § The amplitude of the sample matters! law of large numbers – LLN. (Ex. 1) § Outlier observations can significantly skew the distribution, e. g. mean != median. (Ex. 2) Cov() and corrcoef() can measure correlation among variables. (Ex. 3) § hist(), sort() subplot() vs figure() 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 5
Repetition – Ex. 4 >> loglog(germany(: , 2), 'Line. Width', 3); 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 6
Project § Implementation of a model from the Social Science literature in MATLAB § During the next two weeks: Form a group of two to four persons § Choose a topic among the project suggestions (available on line) or propose your own idea § Set up a Git. Hub repository for your group § Complete the research proposal (It is the readme file of your Git. Hub repository) § 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 7
Research Plan Structure § 1 -2 (not more!) pages stating: § § Brief, general introduction to the problem How you abstract the problem with a model Fundamental questions you want to try to answer Existing literature, and previous projects you will base your model on and possible extensions. § https: //github. com/msssm/interesting_projects/wiki § Research methods you are planning to use 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 8
Research Plan § Upon submission, the Research Plan can: be accepted § be accepted under revision § be modified later on only if change is justified (create new version) § § Talk to us if you are not sure § Final deadline for signing-up for a project is: October 22 nd 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 9
Dynamical systems § Mathematical description of the time dependence of variables that characterize a given problem/scenario in its state space. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 10
Dynamical systems § A dynamical system is described by a set of linear/non-linear differential equations. § Even though an analytical treatment of dynamical systems is usually very complicated, obtaining a numerical solution is (often) straight forward. § Differential equation and difference equation are two different tools for operating with Dynamical Systems 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 11
Differential Equations § A differential equation is a mathematical equation for an unknown function (dependent variable) of one or more (independent) explicative variables that relates the values of the function itself and its derivatives of various orders § Ordinary (ODE) : § Partial (PDE) : 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 12
Numerical Solutions for Differential Equations § Solving differential equations numerically can be done by a number of schemes. The easiest way is by the 1 st order Euler’s Method: x x(t) x(t-Δt) t Δt 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 13
A famous example: Pendulum § A pendulum is a simple dynamical system: L = length of pendulum (m) ϴ = angle of pendulum g = acceleration due to gravity (m/s 2) The motion is described by: 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 14
Pendulum: MATLAB code 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 15
Set time step 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 16
Set constants 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 17
Set starting point of pendulum 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 18
Time loop: Simulate the pendulum 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 19
Perform 1 st order Euler’s method 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 20
Plot pendulum 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 21
Set limits of window 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 22
Make a 10 ms pause 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 23
Pendulum: Executing MATLAB code The file pendulum. m may be found on the website! 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 24
Lorenz attractor § The Lorenz attractor defines a 3 -dimensional trajectory by the differential equations: § σ, r, b are parameters. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 25
Lorenz attractor: MATLAB code 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 26
Set time step 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 27
Set number of iterations 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 28
Set initial values 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 29
Set parameters 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 30
Solve the Lorenz-attractor equations 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 31
Compute gradient 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 32
Perform 1 st order Euler’s method 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 33
Update time 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 34
Plot the results 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 35
Animation The file lorenzattractor. m may be found on the website! 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 36
2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 37
Food chain 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 38
Lotka-Volterra equations § The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e. g. rabbits vs. foxes. x: number of prey y: number of predators α, β, γ, δ: parameters 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 39
Lotka-Volterra equations § The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e. g. rabbits vs. foxes. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 40
Lotka-Volterra equations § The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e. g. rabbits vs. foxes. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 41
Epidemics Source: Balcan, et al. 2009 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 42
SIR model § A general model for epidemics is the SIR model, which describes the interaction between Susceptible, Infected and Removed (immune) persons, for a given disease. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 43
Kermack-Mc. Kendrick model § Spread of diseases like the plague and cholera? A popular SIR model is the Kermack-Mc. Kendrick model. § The model assumes: A constant population size. § A zero incubation period. § The duration of infectivity is as long as the duration of the clinical disease. § 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 44
Kermack-Mc. Kendrick model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2012 -10 -08 S β transmission R γ recovery K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch I 45
Kermack-Mc. Kendrick model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 46
Kermack-Mc. Kendrick model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 47
Exercise 1 § Implement and simulate the Kermack. Mc. Kendrick model in MATLAB. Use the starting values: S=I=500, R=0, β=0. 0001, γ =0. 01 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 48
Exercise 2 § A key parameter for the Kermack-Mc. Kendrick model is the epidemiological threshold, βS/γ. Plot the time evolution of the model and investigate the influence of the epidemiological threshold, in particular the cases: 1. 2. βS/γ < 1 βS/γ > 1 Starting values: S=I=500, R=0, β=0. 0001 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 49
Exercise 3 - optional § Implement the Lotka-Volterra model and investigate the influence of the timestep, dt. § How small must the timestep be in order for the 1 st order Euler‘s method to give reasonable accuracy? § Check in the MATLAB help how the functions ode 23, ode 45 etc, can be used for solving differential equations. 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 50
References § Matlab and Art: http: //vlab. ethz. ch/ROM/DBGT/MATLAB_and_art. html § Kermack, W. O. and Mc. Kendrick, A. G. "A Contribution to the Mathematical Theory of Epidemics. " Proc. Roy. Soc. Lond. A 115, 700 -721, 1927. § "Lotka-Volterra Equations”. http: //mathworld. wolfram. com/Lotka. Volterra. Equations. html § § http: //en. wikipedia. org/wiki/Numerical_ordinary_differential_equations "Lorenz Attractor”. http: //mathworld. wolfram. com/Lorenz. Attractor. html 2012 -10 -08 K. Donnay & S. Balietti / kdonnay@ethz. ch sbalietti@ethz. ch 51
- Late postmortem changes
- Postmortem signs
- Helen erickson biography
- 10 cfr 851
- Health and safety act ontario
- Place value drawing
- Relational modeling vs dimensional modeling
- National general 888-781-0585
- Ngic 888-781-0585
- Social thinking adalah
- Social thinking social influence social relations
- Decision trees show the logic structure in a
- Modeling with quadratic functions
- Dfd chapter 5
- Social darwinism paralleled the economic doctrine of
- Simulation modeling and analysis law kelton
- Sequential decision analytics and modeling
- Log to exponential form
- Dfd chapter 5
- System requirements checklist output example
- Business process and functional modeling
- Business process and functional modeling
- Modeling and imitation training aba
- Modeling and imitation
- Algebra 1 bootcamp functions and modeling answer key
- Algebra bootcamp answers
- Algebra 1 boot camp
- Rad design workshop
- Additive and subtractive modeling
- Patched up prototype
- Jackie buys 3 hot dogs and 1 pretzel
- 2019 algebra 1 bootcamp answers
- Object oriented modeling and design books
- Pharmaceutical simulation and modeling
- Introduction to modeling and simulation
- Jeff renz
- Mathematical modeling and engineering problem solving
- Biomedical modeling and simulation
- Device modeling for analog and rf cmos circuit design
- What is the primary goal in agile modeling
- Solid
- Pengertian pemodelan dan simulasi
- Computational engineering and physical modeling
- Geometric modeling in probability and statistics
- Addition property of equality
- Competency model vs job analysis
- Merger and acquisition financial modeling
- Softwares can_ -in designing and modeling in every field
- Mathematical modeling and engineering problem solving
- Modeling and simulation
- Image-based modeling
- Modeling and visualization of leaf venation patterns