stratify {optimStrat} | R Documentation |
Stratification of an Auxiliary Variable
Description
Stratify the auxiliary variable x
into H
strata using the cum-sqrt-rule.
Usage
stratify(x, H, forced = FALSE, J = NULL)
Arguments
x |
a positive numeric vector giving the values of the auxiliary variable. |
H |
a positive integer smaller or equal than |
forced |
a logical value indicating if the number of strata must be exactly equal to |
J |
a positive integer indicating the number of bins used for the cum-sqrt-rule. |
Details
The cum-sqrt-rule is used in order to define H
strata from the auxiliary vector x
.
Depending on some characteristics of x
, e.g. high skewness, few observations or too many ties, the resulting stratification may have a number of strata other than H
. Using forced = TRUE
tries its best to obtain exactly H
strata.
Note that if length(x) < H
then forced
will be set to FALSE
.
Value
A numeric vector giving the stratum to which each observation in x
belongs.
References
Sarndal, C.E., Swensson, B. and Wretman, J. (1992). Model Assisted Survey Sampling. Springer.
See Also
optiallo
for allocating the sample into the strata using Neyman optimal allocation.
Examples
x<- 1 + sort( rgamma(100, shape=4/9, scale=108) )
stratify(x, H=3)