Home Download Help Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish

NetLogo User Community Models(back to the NetLogo User Community Models)
## WHAT IS IT?
This is a model of the fundamental law of population genetics a.k.a. HardyWeinberg equilibrium. The model is strictly adherent to the implicit and explicit assumptions originally made in 1908 by the English mathematician Godfrey Harold Hardy and the German physician Wilhelm Weinberg. These assumptions are summarized as follows:
* the organism is diploid;
Based on these assumptions, the simulation shows that equilibrium of genotypic and allele frequencies is reached in one generation, and the population remains in equilibrium in successive generations. Verification of HardyWeinberg equilibrium in the population is done with the chisquare test.
## HOW IT WORKS
Three agents' types with a "person" shape  one for each genotype  are implemented as as described hereafter:
1) white agents = "dd", homozygous genotype for the dominant phenotype;
After fixing the initial number of individuals, each with a specific genotype, an equal number of males and females is assigned. Sex ratio is then maintained constantly = 1 throughout simulation. At ythe start of simulation, agents are arranged in a circle. The circular arrangement was chosen to facilitate visualization of random mating through the formation of links between agents of opposite sex. For each generation, each partner can only mate with a partner of opposite sex who is not engaged already in another mating event. After reproduction, the population of parents is completely replaced by the population of their offspring, which bears the specific genotypes predicted on the basis of Mendelian segregation rules. Over generations, population size remains constant Overlapping generations are never allowed because parents "die" at each generation after they have reproduced. The model uses a chisquare formula with correction for small sample size (i.e., expected values of genotypes < 5) (Hartl, Clark 2007).
## HOW TO USE IT
Use the sliders to select the initial number of agents with their specific genotypes. Press the setup button to arrange agents in a circle. Simulation consists of two steps to be performed in succession: first mating, then reproduction. These steps are implemented with two buttons to run the simulation in a discrete mode. Alternatively, simulation can be run in a continuous mode by pressing the "go" (forever) button. Evolution of genotype and allele frequency is "p", and genotype frequency is "q") can be followed by watching at the corresponding monitors and plots. Statistical differences between observed and expected number of each genotypic class is calculated, generation after generation, by the chisquare statistics, anf chisquarevalues are reported in the corresponding monitor and plot. If population is in equilibrium chi square does not exceed the critical value which  for one degree of freedom  is = 3,84. This value is represented in the chisquare plot as a red line.
## THINGS TO NOTICE
Note that each generation is equivalent to two ticks, one tick for mating and the next for reproduction.
## THINGS TO TRY
Test the performance of the model with different initial numbers of the three genotypes.
## EXTENDING THE MODEL
The code can be modified to test the effects of evolutionary forces (e.g., selection, mutations, etc.) on HWE.
## NETLOGO FEATURES
The two key primitive terms that were used to implement the mating and the reproduction procedures were "createlinkto" and "hatch" respectively. Furthermore, segregation ratios are stochastically implemented to assign the probabilities ton Mendelian segregation ratios.
## RELATED MODELS
In the Netlogo Models Library look at (i) Hardy Weinberg Equilibrium, (ii) Mendelian Inheritance, and (iii) PopGen Fishbowl.
## CREDITS AND REFERENCES
Hardy, G. H. 1908. Mendelian proportions in a mixed population. Science 28: 4950.
Hartl, D. L., and Clark, A. G. 2007. Principles of Population Genetics (4th edition), Chapter 2 pp. 4592. Sinauer.
Weinberg, W. 1908. Uber den Nachweis der Vererbung beim Menschen. Jahresh. Ver. Vaterl. Naturkd. Wurttemb 64: 369382 (English translations in Boyer 1963 and Jameson 1977).
## HOW TO CITE
For the model itself:
Romano, V., and Tarantino, R. 2021. HardyWeinberg Basic Model.
University of Palermo, Italy 
(back to the NetLogo User Community Models)