NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web


A computer simulation that permits students to model some of the ecological factors affecting the shape of an outbreak of West Nile Virus (WNV).


NetLogo allows you to give commands to two sorts of entities: "turtles" and "patches". Turtles are agents that can move around. Patches are little squares of turf; the display screen is divided into 41 x 33 = 1353 patches. In this model, the only command given to the patches sets the color, gray.

On the other hand, there are four different "breeds" of turtle: humans, robins, cardinals, and mosquitoes. WNV enters the model on (at least one) infected robin. Depending on a robin's "host competence", when a mosquito bites an infected robin, the mosquito might become infected, too. Then, when the mosquito bites someone else -- human, robin, or cardinal -- that individual becomes infected. Humans and cardinals have zero host competence; i.e., even if they are infected, a mosquito cannot become infected by biting them. Mosquitoes do not bite each other.

"Host competence" means the ability of an infected "host" -- a creature other than a mosquito -- to pass on the infection when bitten by a mosquito. Some animals, like the robin, have high host competence, meaning that they are relatively likely to pass on the infection to a biting mosquito. (In this model, robins' host competence is adjustable: experiment!) Other animals, like cardinals and humans, have very low or even zero host competence with respect to WNV. Even when a cardinal is infected, no matter how sick he is, he will not pass on the disease to a biting mosquito. Host competence differs by disease; humans, for example, have effectively zero host competence for WNV, but positive host competence for zika. If a mosquito bites a person with the zika virus, there is a very good chance that the mosquito will become infected.

The model runs for 120 days, intended to simulate the high-WNV risk months June, July, August and September. (In the other seasons, it's too cold for mosquitoes.) In this model, the initial population of robins is set on June 1. Some robins may die, and others may migrate away. No robins are born after June 1. In real life, some robins may live through the summer and, indeed, stay on all winter, but winter is beyond the scope of this model. Mosquitoes, on the other hand, have a relatively short life span, but whenever a mosquito dies, another uninfected mosquito is born to take its place -- so the mosquito population remains constant.

Cardinals do not die. They can become infected with WNV, but biting an infected cardinal will not pass WNV on to the biting mosquito -- cardinals have zero host competence. Cardinals are present in the model to simulate the "dilution effect". The idea of dilution is that the more zero-competence birds present, the more they will be bitten by mosquitoes, and the fewer mosquitoes will become infected and able to pass the disease to humans. Cardinals are not, in real life, the only zero-competence birds that exist; for the model, however, the distinction between cardinals and grackles and blue jays is irrelevant (Why?). Similarly, robins are not the only positive-competence hosts -- indeed, not all such hosts are even birds -- but for the purpose of the model, one positive-competence host is sufficient.

In real life, most humans who get WNV get only mildly sick, a few get very sick, and a very few die. Humans do not recover; they carry the WNV virus for the rest of their lives. However, the primary focus of this model is in the infected robin - mosquito - susceptible robin chain, not the ultimate effect of WNV.


Use the slider bars to set:

human population size
robin population size
cardinal population size
mosquito population size

human movement factors ("angle"): All the "turtles" (NetLogo-speak for agents) move in circles. By adjusting the "angle" you can adjust the size of the circles. The smaller the angle, the bigger the circle: 0 means they move in a straight line; 90 means they move in a small square. (NB. You can adjust the birds' and mosquitoes' movement angles, too, but you have to do it within the code. There is no slider bar for the animals.)

(Also, note that any agent who moves off the right (left) side of the screen immediately reappears on the left (right) side, at the same latitude. Similarly, anybody who moves off the top (bottom) of the screen immediately reappears at the bottom (top).)

initial number of infected robins: Somebody has to introduce the infection into the
community for the plague to begin.

percentage of robins who migrate in August
Most robins migrate away in August. Some stay on all winter.

robins' host competence (as percentage)
Host competence is explained under "How It Works", above.

parameters of robins' migration
This addresses the question, "When do migrating robins (remember, some robins stay put all winter) migrate?" In this model, robins' departure date is set by a gamma distribution (which is, in fact, fairly similar to the more-familiar normal distribution). Robins-Avg refers to the mean (average) departure date: Robins-Avg = 75 means that about half the migrating robins have departed by the 75th day of the model, i.e. August 15.


The intent of this model is to generate some insight into the ecological causes and consequences of an epidemic. Of course, this model is very simple. What factors are omitted? Are they important? If so, do you think you could add them to the model?

One important note: This model makes extensive use of random numbers. They govern whether a robin is going to migrate, whether it is a competent host, whether it is bitten by a nearby mosquito, and many other things. This means for any collection of slider settings, each run of the model will be different. In particular, sometimes a lot of people will get sick, sometimes hardly anyone (even nobody) will get sick. To get an accurate picture of the effects of your selecting slider settings, you have to run the model several times and -- at least -- make mental notes of the outcomes. (It is possible to record the outcomes of each trial for statistical analysis, using an add-on called "Behavior Space" (under the "Tool" pull-down menu), but unless you are confident of your ability with Excel or some other spreadsheet program and know something about statistics, you'll probably become frustrated if you try it. (But... go ahead! Who knows what you'll figure out? That's the fun of NetLogo.))


By adjusting the slider bars, try to mimic the documented pattern of WNV outbreaks. For example, in the Washington DC area a few years ago, no humans got WNV until about the first of August, then, in August and September a few people got sick. The actual numbers don't matter, because in this model you have at most 1,000 people, where in the Washington - Baltimore area you have several million. (NetLogo will allow you to write a program with ten million people, but you'd need a supercomputer to run it.) But see if you can reproduce the pattern -- no WNV until mid-summer, then several (but not an overwhelming number of) cases.


What factors are omitted? Here are a few:

tree cover (degree of urbanization)
weather (esp. rain and heat) -- especially its effect on mosquito populations
baby robins (typically born in late June and July -- they are born uninfected)
sleeping ("roosting") habits of robins -- do they congregate near mosquitoes?
public health measures -- efforts to suppress the mosquito population
additional species of bird (for example, crows are highly susceptible to WNV)
what else?


In NetLogo, each "breed" (here, people, birds or mosquitoes) consists of many agents who behave independently within user-defined guidelines such as infectiousness. Thus, the model conceives biological systems as comprising of individual organisms who can be born, get sick, infect others, die, migrate and do other things while their peers remain unaffected at home.

This is the principal difference between this model and the formal mathematical treatment, usually called the "SIR" model, in which all the members of each breed are treated in the aggregate, not as individuals.


Compare to the Virus program in the Models library, under Biology.

(back to the NetLogo User Community Models)