Learn R Programming

nipnTK (version 0.2.0)

sexRatioTest: Sex Ratio Test

Description

Sex Ratio Test

Usage

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

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

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)

Examples

Run this code
# 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))

Run the code above in your browser using DataLab