expsize {surveyplanning} | R Documentation |
Sample size calculation
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
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 |
H |
The stratum variable. One dimensional object convertible to one-column |
s2h |
The expected population variance |
poph |
Population size in each stratum. One dimensional object convertible to one-column |
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 |
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 |
CVh |
Coefficient of variation (in percentage) to be achieved for each stratum. One dimensional object convertible to one-column |
dataset |
Optional survey data object convertible to |
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
Examples
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