I create a slider controlling the probability of an encounter will lead to an infection.

Begin micro-behaviour

CREATE-INFECTION-ODDS-SLIDER

Begin NetLogo code:
substitute-text-area-for slider-variable-name the-infection-odds               
substitute-text-area-for slider-upper-left-corner-x 625 
substitute-text-area-for slider-upper-left-corner-y 10  
substitute-text-area-for slider-lower-right-corner-x 875 
substitute-text-area-for slider-lower-right-corner-y 50  
substitute-text-area-for slider-minimum-value 0   
substitute-text-area-for slider-maximum-value 1   
substitute-text-area-for slider-increment .01 
substitute-text-area-for slider-initial-value 1.0 

create-slider 
  "slider-variable-name" ; the name of the parameter (a global variable)
  "slider-upper-left-corner-x" "slider-upper-left-corner-y" ; upper left corner (from the upper left corner of the applet) 
  "slider-lower-right-corner-x" "slider-lower-right-corner-y" ; lower right corner 
  "slider-minimum-value" "slider-maximum-value" ; minimum and maximum value
  "slider-increment" ; increment 
  "slider-initial-value" ; initial value
End NetLogo code

Variants

You can change the location, minimum and maximum values, increment, and initial value.

Related Micro-behaviours

POSSIBLE-INFECTION uses the parameter the-infection-odds defined by this slider. Together with CREATE-ENCOUNTER-RATE-SLIDER this specifies β or the force of infection in [1]. CREATE-DEATH-RATE-SLIDER, CREATE-RATE-OF-RECOVERY-SLIDER, CREATE-FRACTION-VACCINATED-AT-BIRTH-SLIDER and CREATE-RATE-OF-LOSS-OF-IMMUNITY-SLIDER create related sliders.

Relation to Mathematical Model

See this.

History

This was implemented by Ken Kahn.

References

[1] "Mathematical models of vaccination", Almut Scherer and Angela McLean, British Medical Bulletin 2002;62 187-199.