This page was automatically generated by NetLogo 4.1. Questions, problems? Contact feedback@ccl.northwestern.edu.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Sun's Java site.

In order for this to work, this file, your model file (boysngirls3.nlogo), and the file NetLogoLite.jar must all be in the same directory. (You can copy NetLogoLite.jar from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If NetLogoLite.jar and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of NetLogoLite.jar in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)

powered by NetLogo

view/download model file: boysngirls3.nlogo

In Chapter Three, Evaluation of Speculation, of March & Lave (1975), in section 3.3.3, they examine the consequences of a parental preference for boys:

"Suppose that each couple agreed (knowing the relative value of things) to produce children (in the usual way) until each couple had more boys (the ones with penises) than girls (the ones without).

And further suppose that the probability of such coupling (technical term) resulting in a boy (the ones with) varies from couple to couple, but not from coupling to coupling for any one couple.

And (we still have a couple more) that no one divorces (an Irish folk tale) or sleeps around (a Scottish folk tale) without precautions (a Swedish folk tale).

And that the expected sex (technical term) of a birth if all couples are producing equally is half male, half female (though mostly they are one or the other).

Question: (Are you ready?) What will be the ratio of boys (with) to girls (without) in such a society?

Answer: The sweet truth is (given the supposings) that we will end up with more girls (without) than boys (with).

(That's beauty, baby.):" (pp.69-70)

Each couple is modelled as a turtle. Each couple has a fixed, small bias (mean 0.0, max +0.1, min -0.1) in its probability (unbiassed mean = 0.5) of producing boys over girls. Each couple remembers the numbers of offspring of each sex it has. Each couple is unhappy until it has more boys than girls.

Choose the number of couples. Choose the fixed bias per couple (vary_bias of 0 means a probability of exactly 0.5, max 10 means a probability in the range 0.4 to 0.6).

The output box and plots are self-explanatory.

With zero bias, there will almost always be more boys than girls in total, when all couples are happy. With large bias, the process will not converge. Instead, there will remain a very small number of couples coupling, and girls will increasingly outnumber boys. The couples more likely to have boys will have smaller families, and those more likely to produce girls will have larger families. Some with many girls and few boys remain unhappy and coupling.

Play with numbers of couples and vary_bias.

Although couples are modelled as turtles, there is no movement of turtles. Instead, couples could be modelled as patches, and the colour of a patch could change when a couple becomes happy.

Note the use of the false attribute in the initiation setup.

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

Model written by Robert Marks, on August 10, 2006.

bobm@agsm.edu.au

James G. March and Charles A. Lave, Introduction to Models in the Social Sciences, New York: HarperCollins, 1975

globals [ ;;these variables are needed across subroutines pc-happy ;;% of turtles (couples) happy because they have more sons than daughterss total-boys ;; in the population total-girls ;; in the population bias2boys ;; average across unhappy couples ] turtles-own [ no-of-boys ;;per couple no-of-girls ;;per couple happy? ;; is this couple happy? (sons > daughters) bias ;; bias to boys in sex probability ] to setup ca crt number ;; number of couples (from slider) ;; this is to place the zero axis on the "Girls minus Boys" plot set-current-plot "Girls minus Boys" set-current-plot-pen "axis" auto-plot-off plotxy 0 0 plotxy 1000000000 0 auto-plot-on ;; end the section to place the zero axis ask turtles [ set happy? false ;; no couple happy at first (no kids) let chsign ( 2 * ( random 2 ) - 1 ) ;; random +1 or -1 set bias ( chsign * ( random-float ( vary_bias / 100 ) ) ) ;; |bias| up to 0.1 ;; each couple has a fixed probability of having sons = 0.5 + bias, ;; where bias has mean zero and a uniform distribution. ;; show bias ] end to go if not any? turtles with [not happy?] [ stop ] ;;stop when all couples happy birth-unhappy-turtles ;;unhappy couples procreate update-globals do-plots do-output end to birth-unhappy-turtles ask turtles with [ not happy? ] ;;is this couple unhappy? [ birth ] ;; then give birth end to birth ifelse ( random-float 1.0 > (0.5 - bias )) ;; son? [ set no-of-boys (no-of-boys + 1) ] ;; yes and increment [ set no-of-girls (no-of-girls + 1) ] ;; no and increment ifelse ( favour-boys? ) ;;is favour boys switch on? [ set happy? ( no-of-boys > no-of-girls ) ] ;; yes--happy now? [ set happy? false ] ;; no--not happy, john end to update-globals set total-boys sum [no-of-boys] of turtles ;; total boys set total-girls sum [no-of-girls] of turtles ;; total girls set pc-happy (count turtles with [happy?]) / (count turtles) * 100 ifelse ( count turtles with [not happy?] = 0 ) [ set bias2boys 0 ] [ set bias2boys (sum [bias] of turtles with [not happy?]) / (count turtles with [not happy?]) ] end to do-plots set-current-plot "Percent Happy Couples" set-current-plot-pen "pc" plot pc-happy set-current-plot "Numbers of Boys and Girls" set-current-plot-pen "Boys" plot total-boys set-current-plot-pen "Girls" plot total-girls set-current-plot "Girls minus Boys" set-current-plot-pen "diff" plot (total-girls - total-boys) set-current-plot "Bias to Boys" set-current-plot-pen "bb" plot 0.5 + bias2boys end to do-output output-print (count turtles with [ not happy? ]) ;; to box end