
Last chance! 50% off unlimited learning
Sale ends in
Compute a simple random sample size using either a target coefficient of variation,
nCont(CV0=NULL, V0=NULL, S2=NULL, ybarU=NULL, N=Inf, CVpop=NULL)
numeric sample size
target value of coefficient of variation of
target value of variance of
unit (population) variance
population mean of target variable
number of units in finite population
unit (population) coefficient of variation
Richard Valliant, Jill A. Dever, Frauke Kreuter
If CVpop
,
or the population mean and variance, ybarU
and S2
, must also be provided.
If S2
must be also be included in the function call.
Valliant, R., Dever, J., Kreuter, F. (2018, chap. 3). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.
nLogOdds
, nProp
, nPropMoe
, nWilson
nCont(CV0=0.05, CVpop=2)
nCont(CV0=0.05, CVpop=2, N=500)
nCont(CV0=0.10/1.645, CVpop=1)
# Compute sample size for a ratio estimator in smho98 population
# Identify large units to select with certainty first
data(smho98)
cert <- smho98[,"BEDS"] > 2000
tmp <- smho98[!cert, ]
tmp <- tmp[tmp[, "BEDS"] > 0, ]
x <- tmp[,"BEDS"]
y <- tmp[, "EXPTOTAL"]
m <- lm(y ~ 0 + x, weights = 1/x)
ybarU <- mean(y)
S2R <- sum(m$residuals^2/(length(x)-1))
nCont(CV0=0.15, S2=S2R, ybarU=ybarU)
Run the code above in your browser using DataLab