Get the variance estimates for a survey estimate
Source:R/survey_statistics_helpers.R
get_var_est.Rd
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.
See vignette("extending-srvyr")
for more details.
Arguments
- stat
A survey statistic object, usually the result of a function from the survey package or svyby.
- vartype
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.
- level
One or more levels to calculate a confidence interval.
- df
Degrees of freedom, many survey functions default to Inf, but srvyr functions generally default to the result of calling degf on the survey object.
- pre_calc_ci
Whether the confidence interval is pre-calculated (as in svyciprop)
- deff
Whether to return the design effect (calculated using survey::deff)