optsize {surveyplanning} | R Documentation |
Optimal sample size allocation
Description
The function computes optimal sample size allocation over strata.
Usage
optsize(
H,
n,
poph,
s2h = NULL,
Rh = NULL,
deffh = NULL,
fullsampleh = NULL,
dataset = NULL
)
Arguments
H |
The stratum variable. One dimensional object convertible to one-column |
n |
Total sample size. One dimensional object with length one. |
poph |
Population size in each stratum. One dimensional object convertible to one-column |
s2h |
The expected population variance |
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 estimate of variable (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 |
fullsampleh |
Variable for detection fully surveyed stratum (optinal). If not defined, it is assumed to be 1 in each stratum (full-response). Object convertible to one-column |
dataset |
Optional survey data object convertible to |
Value
An object as data.table
, with variables:
H
- stratum,
variable
- the name of variable for population variance S^2
,
s2h
- population variance S^2
,
Rh
- the expectedresponse rate,
deffh
- the expected design effect,
poph
- population size,
deffh
- design effect,
fullsampleh
- full sample indicator,
nh
- sample size.
Details
If s2h
and Rh
is not defined, the sample allocation will be calculated as proportional allocation (proportional to the population size).
If Rh
is not defined, the sample allocation will be calculated as Neyman allocation.
See Also
expsize
, dom_optimal_allocation
Examples
library("data.table")
data <- data.table(H = 1 : 3,
s2h=10 * runif(3),
s2h2 = 10 * runif(3),
poph = 8 * 1 : 3,
Rh = rep(1, 3),
dd = c(1, 1, 1))
vars <- optsize(H = "H",
s2h = c("s2h", "s2h2"),
n = 10, poph = "poph",
Rh = "Rh",
fullsampleh = NULL,
dataset = data)
vars