asummary: Summarizing the Allocation

View source: R/helpers.R

asummaryR Documentation

Summarizing the Allocation

Description

[Stable]

A helper function that returns a simple data.frame with summary of the allocation as returned by the opt() or optcost(). See the illustrate example below.

Usage

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

Arguments

x

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

A

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

m

(numeric or NULL)
lower bounds m_1,\ldots,m_H, optionally imposed on sample sizes in strata.

M

(numeric or NULL)
upper bounds M_1,\ldots,M_H, optionally imposed on sample sizes in strata.

Value

A data.frame with as many rows as number of strata H + 1, and up to 7 variables. A single row corresponds to a given stratum h \in \{1,\ldots,H\}, whilst the last row contains sums of all of the numerical values from the above rows (wherever feasible). Summary table has the following columns (* indicates that the column may not be present):

A

population constant A_h

m*

lower bound imposed on sample size in stratum

M*

upper bound imposed on sample size in stratum

allocation

sample size for a given stratum

take_min*

indication whether the allocation is of take-min type, i.e. x_h = m_h

take_max*

indication whether the allocation is of take-max type, i.e. x_h = M_h

take_Neyman

indication whether the allocation is of take-Neyman type, i.e. m_h < x_h < M_h

See Also

opt(), optcost().

Examples

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)
asummary(xopt_1, A, m)

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

wwojciech/stratallo documentation built on Dec. 24, 2024, 10:43 p.m.