Skip to contents

Age Ratio Test is an age-related test of survey and data quality.

Usage

ageRatioTest(x, ratio = 0.85)

Arguments

x

Numeric vector (age)

ratio

Expected age ratio

Value

A lit of class "ageRatioTest" with:

VariableDescription
expectedRExpected sex ratio
expectedPExpected proportion aged 6:29 months
observedRObserved sex ratio
observedPObserved proportion aged 6:29 months
X2Chi-squared test statistic
dfDegrees of freedom for Chi-squared test
pp-value for Chi-squared test

Examples

# Age-ratio test on survey dataset from Kabul, Afghanistan (dp.ex02)
# with an age ratio of 0.85
svy <- dp.ex02
ageRatioTest(svy$age, ratio = 0.85)
#> 
#> 		Age Ratio Test (children's data)
#> 
#>                     Expected age ratio = 0.8500
#> Expected proportion aged 6 - 29 months = 0.4595
#> 
#>                     Observed age ratio = 0.8654
#> Observed proportion aged 6 - 29 months = 0.4639
#> 
#> X-squared = 0.0531, p = 0.8178
#> 

# The age ratio test applied to data for each sex separately
by(svy$age, svy$sex, ageRatioTest, ratio = 0.85)
#> svy$sex: 1
#> 
#> 		Age Ratio Test (children's data)
#> 
#>                     Expected age ratio = 0.8500
#> Expected proportion aged 6 - 29 months = 0.4595
#> 
#>                     Observed age ratio = 0.8638
#> Observed proportion aged 6 - 29 months = 0.4635
#> 
#> X-squared = 0.0145, p = 0.9041
#> 
#> ------------------------------------------------------------ 
#> svy$sex: 2
#> 
#> 		Age Ratio Test (children's data)
#> 
#>                     Expected age ratio = 0.8500
#> Expected proportion aged 6 - 29 months = 0.4595
#> 
#>                     Observed age ratio = 0.8670
#> Observed proportion aged 6 - 29 months = 0.4644
#> 
#> X-squared = 0.0247, p = 0.8750
#>