View source: R/alloc_summary.R
| alloc_summary | R Documentation |
A utility that returns a simple data.frame summarizing the allocation
returned by opt() or optcost().
alloc_summary(x, A, m = NULL, M = NULL)
x |
( |
A |
( |
m |
( |
M |
( |
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:
Population constant A_h.
Lower bound m_h (if provided).
Upper bound M_h (if provided).
The optimized sample size x_h.
Boolean indicator: x_h = m_h.
Boolean indicator: x_h = M_h.
Boolean indicator: m_h < x_h < M_h (or
simply the internal Neyman allocation if no bounds were violated).
opt(), optcost().
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.