Test of differences in survey percentages relative to external estimates
Test of differences in survey percentages relative to external estimates
Compare estimated percentages from the present survey to external estimates from a benchmark source. A Chi-Square test with Rao-Scott's second-order adjustment is used to evaluate whether the survey's estimates differ from the external estimates.
survey_design: A survey design object created with the survey package.
y_var: Name of dependent categorical variable.
ext_ests: A numeric vector containing the external estimate of the percentages for each category. The vector must have names, each name corresponding to a given category.
na.rm: Whether to drop cases with missing values
Returns
A data frame containing the results of the Chi-Square test(s) of whether survey-based estimates systematically differ from external estimates.
The columns of the output dataset include:
statistic: The value of the test statistic
df: Degrees of freedom for the reference Chi-Squared distribution
scale: Estimated scale parameter.
p_value: The p-value of the test of independence
test_method: Text giving the name of the statistical test
variance_method: Text describing the method of variance estimation
Details
Please see svygofchisq for details of how the Rao-Scott second-order adjusted test is conducted. The test statistic, statistic is obtained by calculating the Pearson Chi-squared statistic for the estimated table of population totals. The reference distribution is a Satterthwaite approximation. The p-value is obtained by comparing statistic/scale to a Chi-squared distribution with df degrees of freedom.
Examples
library(survey)# Create a survey design ----data("involvement_survey_pop", package ="nrba")data("involvement_survey_str2s", package ="nrba")involvement_survey_sample <- svydesign( data = involvement_survey_str2s, weights =~BASE_WEIGHT, strata =~SCHOOL_DISTRICT, ids =~ SCHOOL_ID + UNIQUE_ID, fpc =~ N_SCHOOLS_IN_DISTRICT + N_STUDENTS_IN_SCHOOL
)# Subset to only include survey respondents ----involvement_survey_respondents <- subset( involvement_survey_sample, RESPONSE_STATUS =="Respondent")# Test whether percentages of categorical variable differ from benchmark ----parent_email_benchmark <- c("Has Email"=0.85,"No Email"=0.15)chisq_test_vs_external_estimate( survey_design = involvement_survey_respondents, y_var ="PARENT_HAS_EMAIL", ext_ests = parent_email_benchmark
)
References
Rao, JNK, Scott, AJ (1984) "On Chi-squared Tests For Multiway Contigency Tables with Proportions Estimated From Survey Data" Annals of Statistics 12:46-60.