# Load required packages and data
library(dplyr)
data(survey_data)
# Test whether gender is equally distributed
survey_data %>%
chisq_gof(gender)
# Test multiple variables at once
survey_data %>%
chisq_gof(gender, region, education)
# Custom expected proportions
survey_data %>%
chisq_gof(interview_mode, expected = c(0.5, 0.3, 0.2))
# With weights
survey_data %>%
chisq_gof(gender, weights = sampling_weight)
# Grouped analysis
survey_data %>%
group_by(region) %>%
chisq_gof(education)
Run the code above in your browser using DataLab