View source: R/strata.samplesize.R
strata.samplesize | R Documentation |
Calculates the required sample size in order to achieve an absolute or relative sampling error less or equal to the specified for an specific estimator and an optional confidence interval in stratified sampling.
strata.samplesize(
Nh,
var,
error,
alpha,
estimator = c("total", "mean", "proportion", "class total"),
alloc = c("prop", "min", "optim"),
ch,
p,
mean,
replace = FALSE,
relative = FALSE
)
Nh |
Vector of population strata sizes. |
var |
Vector of estimated strata variances. |
error |
Sampling error. |
alpha |
Significance level to obtain confidence intervals. |
estimator |
The estimator to be estimated. Default is "total". |
alloc |
The allocation to be used when taking samples. Default is "prop". |
ch |
Vector of cost per strata to select an individual for the sample. |
p |
Estimated population proportion. If estimator is not "proportion" or "class total" it will be ignored. |
mean |
Estimated population mean. If relative=FALSE it will be ignored. |
replace |
Whether the samples to be taken can have repeated instances or not. |
relative |
Whether the specified error is relative or not. |
With "proportion" and "class total" estimators variance vector must
contain var
return values equal to \frac{Nh}{(Nh-1)}p*(1-p)
values.
Number of instances of the sample to be taken.
strata.samplesize(c(120,100,110,50), c(458, 313,407,364), error=5, alpha=0.05, "mean", "prop")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.