get_var_est {srvyr}R 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,
  grps = "",
  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.

grps

A vector indicating the names of the grouping variables for grouped surveys ("" indicates no groups).

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


[Package srvyr version 1.2.0 Index]