expsize: Sample size calculation

Description Usage Arguments Value See Also Examples

View source: R/expsize.R

Description

The function computes minimum sample size for each stratum to achieve defined precision (CV) for the estimates of totals in each stratum. The calculation takes into account expected totals, population variance, expected response rate and design effect in each stratum.

Usage

1
expsize(Yh, H, s2h, poph, Rh = NULL, deffh = NULL, CVh, dataset = NULL)

Arguments

Yh

The expected totals for variables of interest in each stratum. Object convertible to data.table, variable names as character vector, or column numbers.

H

The stratum variable. One dimensional object convertible to one-column data.table, variable name as character, or column number.

s2h

The expected population variance S^2 for variables of interest in each stratum. Object convertible to data.table, variable name as character vector, or column numbers.

poph

Population size in each stratum. One dimensional object convertible to one-column data.table, variable name as character, or column number.

Rh

The expected response rate in each stratum (optional). If not defined, it is assumed to be 1 in each stratum (full-response). Object convertible to one-column data.table, variable name as character, or column number.

deffh

The expected design effect for the estimates of totals (optional). If not defined, it is assumed to be 1 for each variable in each stratum. Object convertible to data.table, variable name as character vector, or column numbers.

CVh

Coefficient of variation (in percentage) to be achieved for each stratum. One dimensional object convertible to one-column data.table, variable name as character, or column number.

dataset

Optional survey data object convertible to data.table with one row for each stratum.

Value

A data.table is returned by the function, with variables:
H - stratum,
variable - the name of variable of interest,
estim - total value,
deffh - the expected design effect,
s2h - population variance S^2,
CVh - the expected coefficient of variation,
Rh - the expected response rate,
poph - population size,
nh - minimal sample size to achieve defined precision (CV).

See Also

expvar, optsize, MoE_P

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library("data.table")
data <- data.table(H = 1:3, Yh = 10 * 1:3,
                   Yh1 = 10 * 4:6, s2h = 10 * runif(3),
                   s2h2 = 10 * runif(3), CVh = rep(4.9,3),
                   poph = 8 * 1:3, Rh = rep(1, 3),
                   deffh = rep(2, 3), deffh2 = rep(3, 3))

size <- expsize(Yh = c("Yh", "Yh1"), H = "H",
                s2h = c("s2h", "s2h2"), poph = "poph",
                Rh = "Rh", deffh = c("deffh", "deffh2"),
                CVh = "CVh", dataset = data)

size

surveyplanning documentation built on July 1, 2020, 10:38 p.m.