Skip to contents

Sex Ratio Test

Usage

sexRatioTest(sex, codes = c(1, 2), pop = c(1, 1))

Arguments

sex

A vector of values that indicate sex

codes

Codes used to identify males and females (in that order)

pop

Relative populations of males and females (in that order)

Value

A list of class "sexRatioTest" with:

VariableDescription
pMObserved proportion male
eMExpected proportion male
X2Chi-squared test statistic
dfDegrees of freedom for Chi-squared test
pp-value for Chi-squared test

Examples

# Use sexRatioTest() on household roster data from a survey in Tanzania
# (as.ex01) and census data of Tanzania extracted from Wolfram|Alpha knowledge
# engine (as.ex02)
svy <- as.ex01
ref <- as.ex02
censusM <- sum(ref$Males)
censusF <- sum(ref$Females)
sexRatioTest(svy$sex, codes = c(1, 2), pop = c(censusM, censusF))
#> 
#> 	Sex Ratio Test
#> 
#> Expected proportion male = 0.4988
#> Observed proportion male = 0.4914
#> X-squared = 1.8713, p = 0.1713
#>