Learn R Programming

stratallo (version 2.1.0)

rnabox: Recursive Neyman Algorithm for Optimal Sample Allocation Under Box-Constraints in Stratified Sampling Schemes

Description

[Stable]

An internal function that implements recursive Neyman optimal allocation algorithm, rnabox. The rnabox() should not be used directly. Instead, user function dopt() should be used.

The rnabox() function computes: $$argmin D(x_1,...,x_H) = a^2_1/x_1 + ... + a^2_H/x_H - b,$$ under the equality constraint imposed on total sample size: $$x_1 + ... + x_H = n,$$ and (optionally) the following set of inequality constraints: $$m_w <= x_w <= M_w, w = 1,...,H.$$ Here, \(H\) denotes total number of strata, \(x_1, ..., x_H\) are the strata sample sizes, and \(m_w > 0, M_w > 0, w = 1, ..., H\) are the lower and upper bounds respectively, optionally imposed on sample sizes in strata.

User of rnabox() can choose which or whether the inequality constraints will be added to the optimization problem or not. In case of no inequality constraints to be added, m or M (or both) must be specified as NULL (default). If any bounds should be imposed on sample strata sizes, user must specify these with m and M arguments.

Usage

rnabox(n, a, m = NULL, M = NULL)

Value

Numeric vector with optimal sample allocations in strata.

Arguments

n

(number)
total sample size. A strictly positive scalar.

a

(numeric)
parameters \(a_1, ..., a_H\) of variance function \(D\). Strictly positive numbers.

m

(numeric or NULL)
optional lower bounds constraints imposed on strata sample sizes. If it is not NULL, it is required that n >= sum(m). Strictly positive numbers.

M

(numeric or NULL)
optional upper bounds constraints imposed on strata sample sizes. If it is not NULL, it is required that n <= sum(M). Strictly positive numbers.

References

To be added soon.

See Also

dopt(), nopt(), sga(), sgaplus(), coma().

Examples

Run this code
# Artificial population and the bounds that to be imposed.
N <- c(454, 10, 116, 2500, 2240, 260, 39, 3000, 2500, 400)
S <- c(0.9, 5000, 32, 0.1, 3, 5, 300, 13, 20, 7)
a <- N * S
m <- c(322, 3, 57, 207, 715, 121, 9, 1246, 1095, 294)
M <- N

# An example of a regular allocation.
n <- 6000
opt_regular <- rnabox(n, a, m, M)

# An example of a vertex allocation.
n <- 4076
opt_vertex <- rnabox(n, a, m, M)

Run the code above in your browser using DataLab