Learn R Programming

surveyplanning (version 0.2)

expvar: Expected precision for the estimates of totals

Description

The function computes expexted precision as variance, standard error, and coefficient of variation for the estimates of totals.

Usage

expvar(Yh, H, s2h, nh, poph, Rh = NULL, deffh = NULL, Dom = NULL, dataset = NULL)

Arguments

Value

A list with two data objects:resultHAn object as data.table, with variables: H - stratum, variable - the name of variable of interest, estim - total value, deffh - design effect, s2h - population variance $S^2$, nh - sample size, Rh - response rate, poph - population size, nrh - expected number of respondents, var - expected variance, se - expected standard error, cv - expected coeficient of variance.resultAn object as data.table, with variables: Dom - domain, variable - the name of variable of interest, poph - the population size, nh - sample size, nrh - expected number of respondents, estim - total value, var - the expected variance, se - the expected standart error, cv - the expected coeficient of variance.

See Also

expsize, optsize

Examples

Run this code
data <- data.table(H = 1:3,
                   Yh = 10 * 1:3, Yh1 = 10 * 4:6,
                   s2h = 10 * runif(3), s2h2 = 10 * runif(3),
                   nh = rep(4 * 1:3),
                   poph = 8 * 1:3,
                   Rh = rep(1, 3),
                   deffh = rep(2, 3), deffh2 = rep(3, 3),
                   dd = c(1, 1, 1))

vars <- expvar(Yh = c("Yh", "Yh1"), H = "H",
               s2h = c("s2h", "s2h2"),
               nh = "nh", poph = "poph",
               Rh = "Rh", deffh = c("deffh", "deffh2"),
               dataset = data)

vars

Run the code above in your browser using DataLab