Get the variance estimates for a survey estimate
This is a helper to allow srvyr's syntactic style. In general, users
will not have to worry about getting survey variance estimates directly
unless they are trying to extend srvyr. This function helps convert from
the result of a survey function into a data.frame with an estimate and
measures of variance around it in a way that summarize expects.
vignette("extending-srvyr") for more details.
get_var_est(stat, vartype, grps = "", level = 0.95, df = Inf, pre_calc_ci = FALSE, deff = FALSE)
A survey statistic object, usually the result of a function from the survey package or svyby.
A vector indicating which variance estimates to calculate (options are se for standard error, ci for confidence interval, var for variance or cv for coefficient of variation). Multiples are allowed.
A vector indicating the names of the grouping variables for grouped surveys ("" indicates no groups).
One or more levels to calculate a confidence interval.
Degrees of freedom, many survey functions default to Inf, but srvyr functions generally default to the result of calling degf on the survey object.
Whether the confidence interval is pre-calculated (as in svyciprop)
Whether to return the design effect (calculated using survey::deff)
a tbl_svy with the variables modified