# 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)
Run the code above in your browser using DataLab