Learn R Programming

stratallo (version 2.1.0)

allocation_summary: Summarizing the Allocation

Description

[Stable]

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

Usage

allocation_summary(x, a, m = NULL, M = NULL)

Value

A data.frame with the allocation summary.

Arguments

x

(numeric)
the allocation vector.

a

(numeric)
parameters \(a_1, ..., a_H\) of variance function \(D\). See dopt() or nopt() for more details.

m

(numeric or NA)
lower bounds constraints imposed on sample sizes in strata.

M

(numeric or NA)
upper bounds constraints imposed on sample sizes in strata.

Details

The summary data.frame contains the following columns:
(1) the allocation vector,
(2) lower bounds constraints (optional),
(3) upper bounds constraints (optional),
(4) indication whether the allocation for a given stratum is of take-min type, i.e. x == m (optional),
(5) indication whether the allocation for a given stratum is of take-max type, i.e. x == M (optional),
(6) indication whether the allocation for a given stratum is of take-neyman type, i.e. m < x < M.
The last row contains the sum of all of the values from the other rows (wherever feasible).

Examples

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

x1 <- dopt(n = 400, a, m)
s1 <- allocation_summary(x1, a, m)

x2 <- dopt(n = 540, a, m, M)
s2 <- allocation_summary(x2, a, m, M)

Run the code above in your browser using DataLab