Skip to contents

The number of boys in a sample of 2,444 two-child families.

Usage

TwoKids

Format

A data frame with 3 observations on the following 2 variables.

num.boys

a numeric vector

count

a numeric vector

Source

Rodgers, J.L. and D. Doughty. 2001. Does having boys or girls run in the family? Chance Magazine Fall 2001: 8-13.

Examples


TwoKids
#>   num.boys count
#> 1        0   530
#> 2        1  1332
#> 3        2   582
observed <- TwoKids$count
expected <- c(585.3, 1221.4, 637.3)
chisq.test(observed, p = expected, rescale.p = TRUE)
#> 
#> 	Chi-squared test for given probabilities
#> 
#> data:  observed
#> X-squared = 20.038, df = 2, p-value = 4.454e-05
#> 

# Alternate calculation, using Pr[male] = 0.512
# and rbinom. See Figure 5.7-1
n <- sum(observed)
pr.m <- 0.512
pr.f <- 0.488

# Calculate the probabilities of 0, 1, and 2 males
(pr.0 <- pr.f^2)
#> [1] 0.238144
(pr.1 <- pr.m * pr.f + pr.f * pr.m)
#> [1] 0.499712
(pr.2 <- pr.m^2)
#> [1] 0.262144

set.seed(1)
(expected2 <- c(rbinom(1, n, pr.0),
                rbinom(1, n, pr.1),
                rbinom(1, n, pr.2)))
#> [1]  582 1215  613
chisq.test(observed, p = expected2, rescale.p = TRUE)
#> 
#> 	Chi-squared test for given probabilities
#> 
#> data:  observed
#> X-squared = 16.764, df = 2, p-value = 0.0002289
#>