expvar {surveyplanning} | R Documentation |
Expected precision for the estimates of totals
Description
The function computes expected precision as variance, standard error, and coefficient of variation for the estimates.
Usage
expvar(
Yh,
Zh = NULL,
H,
s2h,
nh,
poph,
Rh = NULL,
deffh = NULL,
Dom = NULL,
dataset = NULL
)
Arguments
Yh |
The expected totals for variables of interest in each stratum. Object convertible to |
Zh |
Optional variables of denominator for the expected ratio estimation in each stratum. Object convertible to |
H |
The stratum variable. One dimensional object convertible to one-column |
s2h |
The expected population variance |
nh |
Sample size in each stratum. One dimensional object convertible to one-column |
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. If is defined, then variables is defined the same arrangement as |
Dom |
Optional variables used to define population domains. Only domains as unions of strata can be defined. If supplied, estimated precision is calculated for each domain. An object convertible to |
dataset |
Optional survey data object convertible to |
Value
A list with three data objects:
resultH |
An object as |
resultDom |
An object as |
result |
An object as |
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), nh = rep(4 * 1:3),
poph = 8 * 1:3, Rh = rep(1, 3),
deffh = rep(2, 3), deffh2 = rep(3, 3))
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