Learn R Programming

stratallo (version 3.0.1)

alloc_summary: Summarizing the Allocation

Description

[Stable]

A utility that returns a simple data.frame summarizing the allocation returned by opt() or optcost().

Usage

alloc_summary(x, A, m = NULL, M = NULL)

Value

A data.frame with \(H + 1\) rows and up to seven variables, where \(H\) is the number of strata. The first \(H\) rows correspond to strata \(h = 1,\ldots,H\), while the last row contains column totals (where applicable). The columns include:

A

Population constant \(A_h\).

m*

Lower bound \(m_h\) (if provided).

M*

Upper bound \(M_h\) (if provided).

allocation

The optimized sample size \(x_h\).

take_min*

Boolean indicator: \(x_h = m_h\).

take_max*

Boolean indicator: \(x_h = M_h\).

take_Neyman

Boolean indicator: \(m_h < x_h < M_h\) (or simply the internal Neyman allocation if no bounds were violated).

Arguments

x

(numeric)
sample allocations \(x_1,\ldots,x_H\).

A

(numeric)
population constants \(A_1,\ldots,A_H\).

m

(numeric or NULL)
optional lower bounds \(m_1,\ldots,m_H\).

M

(numeric or NULL)
optional upper bounds \(M_1,\ldots,M_H\).

See Also

opt(), optcost().

Examples

Run this code
A <- c(3000, 4000, 5000, 2000)
m <- c(100, 90, 70, 80)
M <- c(200, 150, 300, 210)

xopt_1 <- opt(n = 400, A, m)
alloc_summary(xopt_1, A, m)

xopt_2 <- opt(n = 540, A, m, M)
alloc_summary(xopt_2, A, m, M)

Run the code above in your browser using DataLab