get_var_est: Get the variance estimates for a survey estimate

View source: R/survey_statistics_helpers.R

get_var_estR Documentation

Get the variance estimates for a survey estimate

Description

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.

Usage

get_var_est(
  stat,
  vartype,
  level = 0.95,
  df = Inf,
  pre_calc_ci = FALSE,
  deff = FALSE
)

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)

Value

a tbl_svy with the variables modified


srvyr documentation built on Sept. 11, 2024, 8:43 p.m.