Type: | Package |
Title: | Exact Optimal Allocation Algorithms for Stratified Sampling |
Version: | 0.1.0 |
Maintainer: | Andrew M. Raim <andrew.raim@gmail.com> |
Description: | Implements several exact methods for allocating optimal sample sizes when designing stratified samples. These methods are discussed in Wright (2012) <doi:10.1080/00031305.2012.733679> and Wright (2017) <doi:10.1016/j.spl.2017.04.026>. |
License: | MIT + file LICENSE |
Imports: | Rmpfr |
RoxygenNote: | 7.3.2 |
Encoding: | UTF-8 |
VignetteBuilder: | quarto |
Suggests: | quarto |
NeedsCompilation: | no |
Packaged: | 2025-08-22 08:54:19 UTC; araim |
Author: | Andrew M. Raim [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-08-27 16:30:17 UTC |
allocation
Description
Package documentation
Author(s)
Maintainer: Andrew M. Raim andrew.raim@gmail.com
Algorithms for Exact Optimization Allocation
Description
Algorithms III and IV from Wright (2017), and classical unconstrained Neyman allocation (Neyman, 1934).
Usage
allocate_fixn(n0, N, S, lo = NULL, hi = NULL, control = allocation_control())
allocate_neyman(n0, N, S, control = allocation_control())
allocate_prec(v0, N, S, lo = NULL, hi = NULL, control = allocation_control())
Arguments
n0 |
Target sample size for Algorithm III; integer. |
N |
Population size for each stratum; integer vector of length |
S |
Standard deviation for each stratum; numeric vector of length |
lo |
Sample size lower bounds for each stratum; numeric vector of
length |
hi |
Sample size upper bounds for each stratum; numeric vector of
length |
control |
Control object from allocation_control. |
v0 |
Target variance for Algorithm IV; numeric. |
Details
The function allocate_fixn
implements Algorithm III of Wright (2017) and
finds the optimal allocation for a given total sample size n0
. The function
allocate_prec
implements Algorithm IV of Wright (2017) and optimally
allocates units until the overall variance is smaller than a given v0
.
Classical Neyman allocation is implemented by the function
allocate_neyman
.
Value
A list whose structure depends on the allocation method.
allocate_neyman
-
n
: Integer vector with allocationn_1, \ldots, n_H
. -
v
: Value of variance achieved at selected allocation. -
N
: The argumentN
passed to the function. -
S
: The argumentS
passed to the function.
allocate_fixn
-
n
: Integer vector with allocationn_1, \ldots, n_H
. -
iter
: Number of steps taken in the algorithm. -
v
: Value of variance achieved at selected allocation. -
N
: The argumentN
passed to the function. -
S
: The argumentS
passed to the function. -
lo
: The argumentlo
passed to the function. -
hi
: The argumenthi
passed to the function.
allocate_prec
-
n
: Integer vector with allocationn_1, \ldots, n_H
. -
iter
: Number of steps taken in the algorithm. -
v
: Value of variance achieved at selected allocation. -
v0
: The argumentv0
passed to the function. -
N
: The argumentN
passed to the function. -
S
: The argumentS
passed to the function. -
lo
: The argumentlo
passed to the function. -
hi
: The argumenthi
passed to the function.
References
Neyman, Jerzy (1934). On the Two Different Aspects of the Representative Method: The Method of Stratified Sampling and the Method of Purposive Selection. Journal of the Royal Statistical Society, 97 (4): 558-625.
Tommy Wright (2012). The Equivalence of Neyman Optimum Allocation for Sampling and Equal Proportions for Apportioning the U.S. House of Representatives. The American Statistician, 66, pp.217-224.
Tommy Wright (2017), Exact optimal sample allocation: More efficient than Neyman, Statistics & Probability Letters, 129, pp.50-57.
Accessor for to Extract Allocation
Description
Extract the allocation from the result of one of the Allocation-Methods.
Usage
allocation(object)
Arguments
object |
Result from an allocation method |
Value
A numeric vector whose elements contain an allocation for the corresponding stratum.
Control Object for Allocation Methods
Description
Additional arguments (controls) for Allocation-Methods.
Usage
allocation_control(verbose = FALSE, bits = 256, tol = 1e-10, digits = 4)
Arguments
verbose |
Logical; if |
bits |
Number of bits of precision to use with |
tol |
A small positive number for use in allocate_prec; if all strata
have |
digits |
Number of decimals to display in output. |
Value
An list of class allocation_control
.
Examples
out1 = allocation_control()
out2 = allocation_control(verbose = TRUE, bits = 128, tol = 1e-8, digits = 2)