View source: R/prop_allocation.R
| prop_allocation | R Documentation |
Generate a proportional-to-size allocation for stratified sampling.
prop_allocation(
x,
n,
strata,
initial = 0L,
divisor = divisor_method("Jefferson/D'Hondt"),
ties = c("largest", "first")
)
divisor_method(
name = c(
"Jefferson/D'Hondt",
"Webster/Sainte-Lague",
"Imperiali",
"Huntington-Hill",
"Danish",
"Adams",
"Dean"
)
)
x |
|
n |
|
strata |
|
initial |
|
divisor |
|
ties |
|
name |
|
The prop_allocation() function gives a sample size for each level in
strata that is proportional to the sum of x across strata and
adds up to n. This is done using the divisor (highest-averages)
apportionment method \bibcitep|balinski+young1982|appendix A, for which
there are a number of different divisor functions:
\(a) a + 1
\(a) a + 0.5
\(a) a + 2
\(a) sqrt(a * (a + 1))
\(a) a + 1 / 3
\(a) a
\(a) a * (a + 1) / (a + 0.5)
Note that a divisor function with d(0) = 0 (i.e., Huntington-Hill,
Adams, Dean) should have an initial allocation of at least 1 for all strata.
In all cases, ties are broken according to the sum of x if
ties = "largest"; otherwise, if ties = "first", then ties are broken
according to the levels of strata.
In cases where the number of units with non-zero size in a stratum is
smaller than its allocation, the allocation for that stratum is set to the
number of available units, with the remaining sample size reallocated to
other strata proportional to x. This is similar to PROC
SURVEYSELECT in SAS with ALLOC = PROPORTIONAL.
Passing a single integer for the initial allocation first checks that recycling this value for each stratum does not result in an allocation larger than the sample size. If it does, then the value is reduced so that recycling does not exceed the sample size. This recycled vector can be further reduced in cases where it exceeds the number of units in a stratum, the result of which is the initial allocation. This special recycling ensures that the initial allocation is feasible.
prop_allocation() returns a named integer vector of sample sizes for each
stratum in strata.
divisor_method() returns a function giving the desired divisor function.
*
sps() for stratified sequential Poisson sampling.
expected_coverage() to calculate the expected number of strata in a sample
without stratification.
strAlloc() in the PracTools package and the optimall package
for other allocation methods.
# Make a population with units of different size
x <- c(rep(1:9, each = 3), 100, 100, 100)
# ... and 10 strata
s <- rep(letters[1:10], each = 3)
# Generate an allocation
prop_allocation(x, 15, s, initial = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.