Test the independence of survey response and auxiliary variables
Test the independence of survey response and auxiliary variables
Tests whether response status among eligible sample cases is independent of categorical auxiliary variables, using a Chi-Square test with Rao-Scott's second-order adjustment. If the data include cases known to be ineligible or who have unknown eligibility status, the data are subsetted to only include respondents and nonrespondents known to be eligible.
survey_design: A survey design object created with the survey package.
status: A character string giving the name of the variable representing response/eligibility status. The status variable should have at most four categories, representing eligible respondents (ER), eligible nonrespondents (EN), known ineligible cases (IE), and cases whose eligibility is unknown (UE).
status_codes: A named vector, with four entries named 'ER', 'EN', 'IE', and 'UE'.
status_codes indicates how the values of the status variable are to be interpreted.
aux_vars: A list of names of auxiliary variables.
Returns
A data frame containing the results of the Chi-Square test(s) of independence between response status and each auxiliary variable. If multiple auxiliary variables are specified, the output data contains one row per auxiliary variable.
The columns of the output dataset include:
auxiliary_variable: The name of the auxiliary variable tested
statistic: The value of the test statistic
ndf: Numerator degrees of freedom for the reference distribution
ddf: Denominator degrees of freedom for the reference distribution
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 svychisq for details of how the Rao-Scott second-order adjusted test is conducted.
Examples
# Create a survey design object ----library(survey)data(involvement_survey_srs, package ="nrba")involvement_survey <- svydesign( weights =~BASE_WEIGHT, id =~UNIQUE_ID, data = involvement_survey_srs
)# Test whether response status varies by race or by sex ----test_results <- chisq_test_ind_response( survey_design = involvement_survey, status ="RESPONSE_STATUS", status_codes = c("ER"="Respondent","EN"="Nonrespondent","UE"="Unknown","IE"="Ineligible"), aux_vars = c("STUDENT_RACE","STUDENT_SEX"))print(test_results)
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.