Kristjan Kannike

Calculate the Average Number of Children in a Chinese Family

In China and India, boys are valued more than girls.

To use the simulation, copy the file children.py to your Python path (e.g. C:\Python25\Lib\site-packages on Windows) and import everything to the Python shell:>>> from children import *

You can calculate the average number of children by using the function>>> averageChildren(pBoy= 0.5, pAnotherIfBoyAlready=0.6, nMax=10, nTrials = 10000)
(1.734, 1.7629999999999999, 3.4969999999999999)

The 1st number returned is the average number of boys, the 2nd that of girls, and the 3rd that of all children in family.

By default, the probability of having a boy is set to pBoy = 0.5, probability to have another child in case the family already has a boy to pAnotherIfBoyAlready=0.6, the maximal number of children to nMax=10 and the number of families under consideration to nTrials = 10000.

In these days, esp. in China, the number of children in family is under strong regulation. You can take it into account by setting the maximum number of children to one or two.

Girl embryos are often aborted in these countries, so you may experiment with setting the probability of the birth of a boy to a higher value than the natural 0.5.

Created: 17.05.2007

Changed: 18.05.2007