surveyplanning (version 0.6)

optsize: Optimal sample size allocation

Description

The function computes optimal sample size allocation over strata.

Usage

optsize(H, n, poph, s2h = NULL, Rh = NULL, dataset = NULL)

Arguments

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 - response rate, poph - population size, 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, optsize

Examples

Run this code
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", dataset = data)
vars

Run the code above in your browser using DataCamp Workspace