# [R] family question

Troels Ring tring at mail1.stofanet.dk
Wed Aug 30 18:48:01 CEST 2000

```Dear friends. Please see the program below and answer if it does simulate a
population of 1.000.000 families, each with at max 20000 children (typical
in Denmark, you know), constructed such that each family stops having
children when more boys than girls are present ? Equal numbers of boys and
girls are got in the population, according to the simulation, is that obvious ?

ND <- NP <- NULL #ND - number boys, P: girls
for (j in 1:1000000) # number of families
{
n1 <- n2 <- NULL
for (i in 1:20000)  {
n1[i] <- rbinom(1,1,0.5) # each equally likely - here number of boys
n2[i] <- 1- n1[i] # and girls
if(sum(n1)>sum(n2)) break
}
ND[j] <- sum(n1)
NP[j] <- sum(n2)
}
sum(ND)/sum(NP)
j

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```