rnabox {stratallo}R Documentation

Recursive Neyman Algorithm for Optimal Sample Allocation Under Box Constraints

Description

[Stable]

An internal function that implements the RNABOX algorithm that solves the following optimal allocation problem, formulated below in the language of mathematical optimization.

Minimize

f(x_1,\ldots,x_H) = \sum_{h=1}^H \frac{A^2_h}{x_h}

subject to

\sum_{h=1}^H x_h = n

m_h \leq x_h \leq M_h, \quad h = 1,\ldots,H,

where n > 0,\, A_h > 0,\, m_h > 0,\, M_h > 0, such that m_h < M_h,\, h = 1,\ldots,H, and \sum_{h=1}^H m_h \leq n \leq \sum_{h=1}^H M_h, are given numbers. The minimization is on \mathbb R_+^H. Inequality constraints are optional and can be skipped.

rnabox() function should not be called directly by the user. Use opt() instead.

Usage

rnabox(
  n,
  A,
  bounds1 = NULL,
  bounds2 = NULL,
  check_violations1 = .Primitive(">="),
  check_violations2 = .Primitive("<=")
)

Arguments

n

(number)
total sample size. A strictly positive scalar. If bounds1 is not NULL, it is then required that n >= sum(bounds1) (given that bounds1 are treated as lower bounds) or n <= sum(bounds1) (given that bounds1 are treated as upper bounds). If bounds2 is not NULL, it is then required that n >= sum(bounds2) (given that bounds2 are treated as lower bounds) or n <= sum(bounds2) (given that bounds2 are treated as upper bounds).

A

(numeric)
population constants A_1,\ldots,A_H. Strictly positive numbers.

bounds1

(numeric or NULL)
lower bounds m_1,\ldots,m_H, or upper bounds M_1,\ldots,M_H optionally imposed on sample sizes in strata. The interpretation of bounds1 depends on the value of check_violations1. If no one-sided bounds 1 should be imposed, then bounds1 must be set to NULL. If bounds2 is not NULL, it is then required that either bounds1 < bounds2 (in case when bounds1 is treated as lower bounds) or bounds1 > bounds2 (in the opposite case).

bounds2

(numeric or NULL)
lower bounds m_1,\ldots,m_H, or upper bounds M_1,\ldots,M_H optionally imposed on sample sizes in strata. The interpretation of bounds2 depends on the value of check_violations2. If no one-sided bounds 2 should be imposed, then bounds2 must be set to NULL. If bounds2 is not NULL, it is then required that either bounds1 < bounds2 (in case when bounds1 is treated as lower bounds) or bounds1 > bounds2 (in the opposite case).

check_violations1

(function)
2-arguments binary operator function that allows the comparison of values in atomic vectors. It must either be set to .Primitive("<=") or .Primitive(">="). The first of these choices causes that bounds1 are treated as lower bounds and the rnabox() uses the LRNA algorithm as in interim algorithm for the allocation problem with one-sided lower bounds bounds1. The latter option causes that bounds1 are treated as upper bounds and the rnabox() uses the RNA algorithm as in interim algorithm for the allocation problem with one-sided upper bounds bounds1. This parameter is correlated with check_violations2. That is, these arguments must be set against each other. check_violations1 is ignored when bounds1 is set to NULL.

check_violations2

(function)
2-arguments binary operator function that allows the comparison of values in atomic vectors. It must either be set to .Primitive("<=") or .Primitive(">="). The first of these choices causes that bounds2 are treated as lower bounds and the rnabox() uses the LRNA algorithm as in interim algorithm for the allocation problem with one-sided lower bounds bounds2. The latter option causes that bounds2 are treated as upper bounds and the rnabox() uses the RNA algorithm as in interim algorithm for the allocation problem with one-sided upper bounds bounds2. This parameter is correlated with check_violations1. That is, these arguments must be set against each other. check_violations2 is ignored when bounds2 is set to NULL.

Value

Numeric vector with optimal sample allocations in strata.

References

To be added soon.

See Also

opt(), optcost(), sga(), sgaplus(), coma().

Examples

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) # lower bounds
M <- N # upper bounds

# Regular allocation.
n <- 6000
opt_regular <- rnabox(n, A, M, m)

# Vertex allocation.
n <- 4076
opt_vertex <- rnabox(n, A, M, m)

[Package stratallo version 2.2.1 Index]