I create a slider controlling the number of encounters per time period an average infected individual has.

Begin micro-behaviour


Begin NetLogo code:
substitute-text-area-for slider-variable-name the-encounter-rate               
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 10  
substitute-text-area-for slider-increment .1  
substitute-text-area-for slider-initial-value 2   

  "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


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

Related Micro-behaviours

RANDOM-ENCOUNTER uses the parameter the-encounter-rate defined by this slider. Together with CREATE-INFECTION-ODDS-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

The change in the number of infected is given in [1] as the product of the force of infection times the number of infected times the number of susceptible:


In this model the expected change is

the-encounter-ratethe-infection-odds ∙ I ∙ S/N

S/N is the odds that an encounter is with a susceptible individual.

If N (the total population) is constant then

β = the-encounter-rateweeks-in-a-yearthe-infection-odds / N

where weeks-in-a-year is introduced since the-encounter-rate is given in encounters per week while β is per year. This calculation can be performed by MONITOR-FORCE-OF-INFECTION.


This was implemented by Ken Kahn.


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