srvyr wraps the survey package to bring dplyr-compatible syntax to weighted survey analysis. It handles stratified, clustered, and multistage sample designs and returns weighted estimates along with standard errors and confidence intervals.
What’s covered#
- Describing the survey design –
as_survey_designwith ids, strata, fpc, and weights arguments - Replicate weights –
as_survey_rep, replication types, and scale factors - Dealing with lonely PSUs –
survey.lonely.psuoption settings - Database-backed surveys – using
tbl()withas_survey_design - Manipulating data –
filterandmutateon design objects - Summarizing functions –
summarize,survey_count,group_by - Statistical summary functions –
survey_total,survey_mean,survey_prop - Standard errors and confidence intervals –
vartypeargument (se, ci, var, cv) - Proportions and percentages