Contraception Simulation R0
Model was written in NetLogo 6.2.2
•
Viewed 255 times
•
Downloaded 20 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;; ;; Global variables. ;; globals [count_OS0 delta_OS0 EAVG E1up] ;; ;; turtle/breed. ;; ;; ;; turtle/breed variables. ;; turtles-own [ MS ;; mental state, MS = 1 if the agent tends to use correctly the tool, 0 otherwise OS ;; observed state, OS = 1 if the tool has always been used correctly, 0 otherwise. ] ;; ;; setup. ;; to setup clear-all reset-ticks setup-world setup-turtles ;; etc end ;; ;; setup-world. ;; to setup-world ask patches [ set pcolor green + 2] end ;; ;; setup-turtles. ;; to setup-turtles ;; Initialize global variables. ;; Create the turtles and set their initial states. create-turtles number_agents [ set shape "person" setxy random-xcor random-ycor] ;; Initial MS and OS. ask turtles [ ifelse random 100 < S1 [ set MS 1 set color 9.9] [ set MS 0 set color 0 ] set OS 1 ] ;; Update counts. update-counts set EAVG (S1 * E1 + (100 - S1) * E0) / 100 set delta_OS0 0 set E1up E1 end ;; ;; go. ;; to go ;; Criteria to stop. if (ticks > number_ticks) [stop] if (count_OS0 = number_agents) [stop] ;; Otherwise do-things. ;; Update status. update-turtles ;; Update counts. update-counts ;; tick. tick end ;; ;; update-turtles. ;; to update-turtles ask turtles [ ;; update MS with LR0 if MS = 0 [ if random 100 <= LR0 [ set MS 1 if OS = 0 [set color 25] if OS = 1 [set color 9.9] ] ] ;; update OS set E1up E1up * (100 - LR1) / 100 if OS = 1 [ ifelse MS = 0 [ if random 100 <= E0 [set OS 0 set color 15] ] [ if random 100 <= E1up [set OS 0 set color 25] ] ] ] end to update-counts ;; Update counts. set delta_OS0 count turtles with [OS = 0] - count_OS0 set count_OS0 count turtles with [OS = 0] end
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Contraception Simulation R0.png | preview | Preview for 'Contraception Simulation R0' | almost 3 years ago, by Ricardo Gonzalez | Download |
This model does not have any ancestors.
This model does not have any descendants.