sexRatioTest | R Documentation |
Sex Ratio Test
sexRatioTest(sex, codes = c(1, 2), pop = c(1, 1))
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) |
A list of class "sexRatioTest"
with:
Variable | Description |
pM | Observed proportion male |
eM | Expected proportion male |
X2 | Chi-squared test statistic |
df | Degrees of freedom for Chi-squared test |
p | p-value for Chi-squared test |
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.