; breeds [race_one race_two] globals [ time Total_Healthy Total_Normal Total_Unhealthy Total_Kids Total_Adults Percent_Healthy Percent_Normal Percent_Unhealthy Percent_Kids Total_Healthy_One Total_Normal_One Total_Unhealthy_One Total_Healthy_Two Total_Normal_Two Total_Unhealthy_Two Total_Healthy_Three Total_Normal_Three Total_Unhealthy_Three Percent_Healthy_One Percent_Normal_One Percent_Unhealthy_One Percent_Healthy_Two Percent_Normal_Two Percent_Unhealthy_Two Percent_Healthy_Three Percent_Normal_Three Percent_Unhealthy_Three number default ; patch color default youngshade oldshade mean_age mean_expected_life mean_lifespan shock_all? shock_1? shock_2? shock_3? shock_4? region_1_healthy region_1_Normal region_1_unhealthy region_1_kids region_2_healthy region_2_Normal region_2_unhealthy region_2_kids region_3_healthy region_3_Normal region_3_unhealthy region_3_kids region_4_healthy region_4_Normal region_4_unhealthy region_4_kids region_1_total region_2_total region_3_total region_4_total mean_expected_life1 mean_expected_life2 mean_expected_life3 mean_expected_life4 mean_lifespan1 mean_lifespan2 mean_lifespan3 mean_lifespan4 ] turtles-own [ age generation status income random_death Expected_Life region_id Exp_Utility_Healthy Exp_Utility_Normal Exp_Utility_Unhealthy lifestyle ] patches-own [hood_lifespan death_total sum_death_age border? no_data? ] to setup ca set-default-shape turtles "med_circle" set number ((density / 100) * count patches) regions ask random-n-of (number) patches with [border? = false] [ sprout 1 [ set status 65 set color status set age random 60 set generation 1 ] ] ask turtles [ ifelse age < 16 [set lifestyle 0][set lifestyle 2 set status 105 set color status] region-id] set time 0 set shock_all? false set shock_1? false set shock_2? false set shock_3? false set shock_4? false set mean_lifespan1 0 set mean_lifespan2 0 set mean_lifespan3 0 set mean_lifespan4 0 end to regions ask patches [ set border? false if N-Regions = 2 [ if pycor = 0 [set pcolor 9.9999 set border? true]] if N-Regions = 3 [ if pycor = 0 or (pycor < 1 and pxcor = 0) [set pcolor 9.9999 set border? true]] if N-Regions = 4 [if pycor = 0 or pxcor = 0 [set pcolor 9.9999 set border? true]] ] end to go set time time + 1 ask turtles [without-interruption [ wander region-id reproduce ]] ask patches [ update-patches ] ask turtles [without-interruption [ kids-grow-old Healthy-grow-old Normal-grow-old Unhealthy-grow-old ]] do-plots stats regional_stats regional-mean-life shock if count turtles = 0 [ stop ] end to region-id if xcor > 0 and ycor > 0 [set region_id 1] if xcor < 0 and ycor > 0 [set region_id 2] if xcor < 0 and ycor < 0 [set region_id 3] if xcor > 0 and ycor < 0 [set region_id 4] end to kids-grow-old if lifestyle = 0 [ set age age + 1 ;;choose - shading or no shading ;; set color scale-color status age oldshade youngshade set color status ;set expected_life mean values-from neighbors with [border? = false] [hood_lifespan] ifelse (count neighbors with [border? = false and no_data? = false] > 0) [set expected_life mean values-from neighbors with [border? = false and no_data? = false ] [hood_lifespan]] [set expected_life def_life_exp] set random_death random 1000 if ( Random_Death < (10 * Probability_Death_Kid + 1) )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die] if age = 16 [ choose-lifestyle ifelse sum values-from neighbors [count turtles-here with [lifestyle > 0]] < count neighbors with [border? = false] [go-if-empty-nearby][go-if-empty] ] ] end to Healthy-grow-old if lifestyle = 1 [ set age age + 1 ;;choose - shading or no shading ;; set color scale-color status age oldshade youngshade set color status set random_death random 1000 if (age < 50) and ( Random_Death < 10 * Probability_Death_Healthy )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die ] if (age > 50) and (age < 90) and ( Random_Death < (20 + 10 * Probability_Death_Healthy) )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die] if (age = 90 or age > 90) [ set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] set expected_life mean values-from neighbors [hood_lifespan] ] end to Normal-grow-old if lifestyle = 2 [ set age age + 1 ;;choose - shading or no shading ;; set color scale-color status age oldshade youngshade set color status set random_death random 1000 if (age < 50) and ( Random_Death < 10 * Probability_Death_Normal )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die ] if (age > 50) and (age < 90) and ( Random_Death < (20 + 10 * Probability_Death_Normal) )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die ] if (age = 90 or age > 90) [ set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] end to Unhealthy-grow-old if lifestyle = 3 [ set age age + 1 ;;choose - shading or no shading ;; set color scale-color status age oldshade youngshade set color status set random_death random 1000 if (age < 50) and ( Random_Death < 10 * Probability_Death_Unhealthy )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die ] if (age > 50) and (age < 90) and ( Random_Death < (20 + 10 * Probability_Death_Unhealthy) )[ set death_total death_total + 1 set sum_death_age sum_death_age + age die ] if (age = 90 or age > 90) [ set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] end to wander locals [random_movement] set random_movement random 100 if random_movement < movement [ go-if-empty ] end to reproduce if (age > 16 and age < 45 and random 1000 < repro_rate) [ hatch 1 [ set age 0 set generation generation + 1 set lifestyle 0 set status 65 set color status ;; ifelse sum values-from neighbors [count turtles-here] < 8 [go-if-empty-nearby][go-if-empty] ] ] end to go-if-empty ;; turtle procedure locals [empty-patches target] without-interruption [ set empty-patches patches with [not any? turtles-here and border? = false] if any? empty-patches [ set target random-one-of empty-patches set heading towards target fd distance target ] region-id ] end to go-if-empty-nearby ;; turtle procedure locals [empty-patches target] without-interruption [ set empty-patches neighbors with [not any? turtles-here and border? = false] if any? empty-patches [ set target random-one-of empty-patches set heading towards target fd distance target ] region-id ] end to choose-lifestyle ;set Exp_Utility_Healthy (((Expected_Life ) * b_healthy ) + a_healthy) ;set Exp_Utility_Normal (((Expected_Life ) * b_normal ) + a_normal) ;set Exp_Utility_Unhealthy (((Expected_Life ) * b_unhealthy ) + a_unhealthy) ifelse discounting? = false [ set Exp_Utility_Healthy (((Expected_Life - 16) * b_healthy) + a_healthy) set Exp_Utility_Normal (((Expected_Life - 16) * b_normal) + a_normal) set Exp_Utility_Unhealthy (((Expected_Life - 16) * b_unhealthy) + a_unhealthy) ] [ set Exp_Utility_Healthy (a_healthy + ((b_healthy * (1 - exp(- rate * (Expected_Life - 16 )))) / (exp(rate) - 1))) set Exp_Utility_Normal (a_normal + ((b_normal * (1 - exp(- rate * (Expected_Life - 16)))) / (exp(rate) - 1))) set Exp_Utility_Unhealthy (a_unhealthy + ((b_unhealthy * (1 - exp(- rate * (Expected_Life - 16)))) / (exp(rate) - 1))) ] ifelse (Exp_Utility_Healthy >= Exp_Utility_Normal) and (Exp_Utility_Healthy >= Exp_Utility_Unhealthy and Healthy_Option = true) [set lifestyle 1 set status 89] [ ifelse (Exp_Utility_Normal >= Exp_Utility_Unhealthy ) [set lifestyle 2 set status 105][ set lifestyle 3 set status 26]] end to update-patches set no_data? false ifelse death_total > 0 [set hood_lifespan (sum_death_age / death_total)] [set no_data? true set hood_lifespan mean_expected_life] end to shock if timedshock1 = true and time > 39 and time < 50 [set shock_1? true] if shock_all? [ ask random-n-of shock_size turtles [ set shock_all? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] if shock_1? [ ifelse N-regions = 2 or N-regions = 3 [ ask random-n-of shock_size turtles with [ycor > 0] [ set shock_1? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] [ ask random-n-of shock_size turtles with [ycor > 0 and xcor > 0] [ set shock_1? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] ] if shock_2? [ ifelse N-regions = 2 or N-regions = 3 [ ask random-n-of shock_size turtles with [ycor < 0] [ set shock_2? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] [ ask random-n-of shock_size turtles with [ycor > 0 and xcor < 0] [ set shock_2? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] ] if shock_3? [ ifelse N-regions = 3 [ ask random-n-of shock_size turtles with [ycor < 0 and xcor > 0] [ set shock_3? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] [ ask random-n-of shock_size turtles with [ycor < 0 and xcor < 0] [ set shock_3? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] ] if shock_4? [ if N-regions = 4 [ ask random-n-of shock_size turtles with [ycor < 0 and xcor > 0] [ set shock_4? false set death_total death_total + 1 set sum_death_age sum_death_age + age set pcolor default die ] ] ] end to regional_stats set region_1_kids count turtles with [lifestyle = 0 and region_id = 1] set region_1_healthy count turtles with [lifestyle = 1 and region_id = 1] set region_1_Normal count turtles with [lifestyle = 2 and region_id = 1] set region_1_unhealthy count turtles with [lifestyle = 3 and region_id = 1] set mean_expected_life1 mean values-from turtles with [region_id = 1] [expected_life] set region_2_kids count turtles with [lifestyle = 0 and region_id = 2] set region_2_healthy count turtles with [lifestyle = 1 and region_id = 2] set region_2_Normal count turtles with [lifestyle = 2 and region_id = 2] set region_2_unhealthy count turtles with [lifestyle = 3 and region_id = 2] set mean_expected_life2 mean values-from turtles with [region_id = 2] [expected_life] set region_3_kids count turtles with [lifestyle = 0 and region_id = 3] set region_3_healthy count turtles with [lifestyle = 1 and region_id = 3] set region_3_Normal count turtles with [lifestyle = 2 and region_id = 3] set region_3_unhealthy count turtles with [lifestyle = 3 and region_id = 3] set mean_expected_life3 mean values-from turtles with [region_id = 3] [expected_life] set region_4_kids count turtles with [lifestyle = 0 and region_id = 4] set region_4_healthy count turtles with [lifestyle = 1 and region_id = 4] set region_4_Normal count turtles with [lifestyle = 2 and region_id = 4] set region_4_unhealthy count turtles with [lifestyle = 3 and region_id = 4] set mean_expected_life4 mean values-from turtles with [region_id = 4] [expected_life] set region_1_total count turtles with [region_id = 1] set region_2_total count turtles with [region_id = 2] set region_3_total count turtles with [region_id = 3] set region_4_total count turtles with [region_id = 4] end to regional-mean-life if time > 20 [ set mean_lifespan1 (sum values-from patches with [pxcor > 0 and pycor > 0] [sum_death_age] / sum values-from patches with [pxcor > 0 and pycor > 0] [death_total]) set mean_lifespan2 (sum values-from patches with [pxcor < 0 and pycor > 0] [sum_death_age] / sum values-from patches with [pxcor < 0 and pycor > 0] [death_total]) set mean_lifespan3 (sum values-from patches with [pxcor < 0 and pycor < 0] [sum_death_age] / sum values-from patches with [pxcor < 0 and pycor < 0] [death_total]) set mean_lifespan4 (sum values-from patches with [pxcor > 0 and pycor < 0] [sum_death_age] / sum values-from patches with [pxcor > 0 and pycor < 0] [death_total]) ] end to stats ifelse time > 2 [ set mean_age mean values-from turtles [age] set mean_expected_life mean values-from turtles [expected_life] ] [set mean_expected_life def_life_exp] if time > 20 [set mean_lifespan (sum values-from patches [sum_death_age] / sum values-from patches [death_total])] set Total_Healthy count turtles with [lifestyle = 1] set Total_Normal count turtles with [lifestyle = 2] set Total_Unhealthy count turtles with [lifestyle = 3] set Total_Kids count turtles with [lifestyle = 0] set Total_Adults count turtles with [lifestyle > 0] set percent_kids (Total_Kids / count turtles) set percent_healthy (Total_healthy / Total_Adults) set percent_normal (Total_normal / Total_Adults) set percent_unhealthy (Total_unhealthy / Total_Adults) end to do-plots set-current-plot "Mean Lifespan and Expected Lifespan" set-current-plot-pen "Mean Lifespan" plot mean_lifespan set-current-plot-pen "Expected Lifespan" plot mean_expected_life set-current-plot "Unhealthy" set-current-plot-pen "Unhealthy 1" plot region_1_unhealthy set-current-plot-pen "Unhealthy 2" plot region_2_unhealthy set-current-plot-pen "Unhealthy 3" plot region_3_unhealthy set-current-plot-pen "Unhealthy 4" plot region_4_unhealthy end @#$#@#$#@ GRAPHICS-WINDOW 261 10 702 472 20 20 10.5122 1 20 0 0 0 0 CC-WINDOW 5 720 887 815 Command Center BUTTON 8 10 93 43 Setup setup NIL 1 T OBSERVER T NIL MONITOR 98 11 182 60 total population count turtles 3 1 BUTTON 7 44 93 77 Go/Pause go T 1 T OBSERVER NIL NIL SLIDER 704 227 877 260 Probability_Death_Healthy Probability_Death_Healthy 0 25 1.0 0.1 1 NIL SLIDER 7 80 150 113 density density 0 100 70 1 1 NIL MONITOR 185 11 242 60 NIL time 0 1 SLIDER 704 262 877 295 Probability_Death_Normal Probability_Death_Normal 0 25 1.3 0.1 1 NIL SLIDER 703 297 878 330 Probability_Death_Unhealthy Probability_Death_Unhealthy 0 50 1.6 0.1 1 NIL SLIDER 6 122 151 155 Movement Movement 0 100 2 1 1 NIL SLIDER 5 169 152 202 repro_rate repro_rate 0 100 45 1 1 NIL SLIDER 5 217 153 250 def_life_exp def_life_exp 0 100 50 1 1 NIL TEXTBOX 157 179 247 197 Births per 1000 TEXTBOX 157 219 247 249 Default expected lifespan TEXTBOX 158 124 248 154 Prct. of Pop. that moves each turn TEXTBOX 156 81 259 126 Prct. of patches that start with an agent SLIDER 5 259 97 292 N-Regions N-Regions 1 4 4 1 1 NIL BUTTON 699 343 754 383 Shock all set shock_all? true NIL 1 T OBSERVER T NIL BUTTON 815 332 870 365 shock 1 set Shock_1? true\n NIL 1 T OBSERVER T NIL BUTTON 756 332 811 365 shock 2 set shock_2? true NIL 1 T OBSERVER T NIL BUTTON 757 369 812 402 shock 3 set shock_3? true NIL 1 T OBSERVER T NIL BUTTON 816 369 871 402 shock 4 set shock_4? true NIL 1 T OBSERVER T NIL SLIDER 705 441 819 474 shock_size shock_size 0 500 15 1 1 NIL SLIDER 706 12 855 45 a_healthy a_healthy 0 1000 0 1 1 NIL SLIDER 705 119 838 152 b_healthy b_healthy 0 100 50 1 1 NIL SLIDER 704 49 856 82 a_normal a_normal 0 1000 226 1 1 NIL SLIDER 705 156 840 189 b_normal b_normal 0 100 40 1 1 NIL SLIDER 705 87 856 120 a_unhealthy a_unhealthy 0 1000 416 1 1 NIL SLIDER 706 193 841 226 b_unhealthy b_unhealthy 0 100 30 1 1 NIL PLOT 17 478 430 620 Mean Lifespan and Expected Lifespan NIL NIL 0.0 400.0 45.0 70.0 false true PENS "Mean Lifespan" 1.0 0 -16777216 true "Expected Lifespan" 1.0 0 -65536 true TEXTBOX 121 264 221 282 Number of Regions SWITCH 704 403 829 436 timedshock1 timedshock1 0 1 -1000 SLIDER 0 421 172 454 Probability_Death_Kid Probability_Death_Kid 0 5 0.2 0.1 1 NIL SLIDER 4 348 176 381 rate rate 0.01 1 0.03 0.01 1 NIL SWITCH 4 305 131 338 Discounting? Discounting? 0 1 -1000 TEXTBOX 7 391 157 409 Discount rate used by agents\n PLOT 439 479 864 619 Unhealthy NIL NIL 0.0 10.0 0.0 10.0 true true PENS "Unhealthy 1" 1.0 0 -65536 true "Unhealthy 2" 1.0 0 -16711681 true "Unhealthy 3" 1.0 0 -16776961 true "Unhealthy 4" 1.0 0 -8716033 true SWITCH 699 673 821 706 Healthy_Option Healthy_Option 0 1 -1000 @#$#@#$#@ RUSSIAN MORBIDITY MODEL THE STORY Within the world constructed the observer (you) has the ability to create a population of agents that will be born, grow up, choose a lifestyle, reproduce, and eventually die. The major areas of concern are the expected and experienced mortality rates, the population breakdown of lifestyles chosen, and the growth/decay rate of the population in large. GETTING STARTED Starting in the upper left-hand corner of the interface, you are presented with a the option to SETUP and GO/PAUSE. When you are ready to begin, you simply hit SETUP to populate the board and GO/PAUSE to initiate the simulation. The simulation may be paused (and subsequently restarted) at anytime by hitting GO/PAUSE. Before you populate the board there are a series of sliders which are in fact parameters thate dictate setup and control the underlying reality of the model. All sliders are in turquoise. The upper left sliders are all setup related (and are labelled accordingly). In the upper right are the sliders which control the coefficents of the agent objective function, and below them the sliders which control the probabilities that govern life and death in the model. Adjacent the the PROBABILITY_DEATH_HEALTHY slider is a switch which allows the user to control whether agents can choose a healthy lifestyle. HOW THE SIMULATION IS PLAYED OUT Agents are born and up until age 16 they simply move around. At age 16 they choose their lifestyle based on an expected utility comparison. E(U) = a + b(expected_lifespan) The keys to the equations are the user assigned coefficients for each lifestyle choice and the age at which he expects to die. These expectations are determined by the 8 neighboring patches that surround him. Each patch keeps a record of the average age of death of past occupants. In sum, the agent's neighborhood is his source of information in forming his expectations. This is the primary means by which agent rationality is bounded, coupled with agents' ingnorance of the underlying probablities. When an agent is born he lives on the same patch as his parent agent. When the "kid" turns 16 he chooses a lifestyle and then tries to move to a neighboring patch. If all of the neighboring patches are full he then moves to a random available patch. Agents may also move in their adult years, randomly chosen at a rate determined by the MOVEMENT slider. ADDITIONAL INFORMATION N-REGIONS allows the user to break the board into 2, 3, or 4 sections. No matter the number of regions each agent carries a region_id tag that identifies where in the standard cartestian plane he exists at any moment. For example, even if there are only two regions, an agent in the lower left corner would have a region_id = 3. SHOCKS are critical to running experiments on the model. Regional shocks and total poplation shocks can be applied, where the SHOCK_SIZE slider will control the absolute number of agents who will die, chosen randome within the region indicated. Region numbers are assigned counter clockwise starting from the upper right. For example, if N-REGIONS = 3, then the large region on top is 1, the lower left is 2, and the lower right is region 3. There exists along the bottom a variety of graphs and monitors that are self-explanatory. CONCLUSION You have been fully indoctrinated. Now go experiment with the model and write a bunch of papers. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 med_circle true 0 Circle -7566196 true true 41 37 220 triangle true 0 Polygon -7566196 true true 46 235 150 43 251 234 @#$#@#$#@ NetLogo 2.1.0 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@