update_weights_strat_wilson {tern} | R Documentation |
Helper function for the estimation of weights for prop_strat_wilson()
Description
This function wraps the iteration procedure that allows you to estimate the weights for each proportional strata. This assumes to minimize the weighted squared length of the confidence interval.
Usage
update_weights_strat_wilson(
vars,
strata_qnorm,
initial_weights,
n_per_strata,
max_iterations = 50,
conf_level = 0.95,
tol = 0.001
)
Arguments
vars |
( |
strata_qnorm |
( |
initial_weights |
( |
n_per_strata |
( |
max_iterations |
( |
conf_level |
( |
tol |
( |
Value
A list
of 3 elements: n_it
, weights
, and diff_v
.
See Also
For references and details see prop_strat_wilson()
.
Examples
vs <- c(0.011, 0.013, 0.012, 0.014, 0.017, 0.018)
sq <- 0.674
ws <- rep(1 / length(vs), length(vs))
ns <- c(22, 18, 17, 17, 14, 12)
update_weights_strat_wilson(vs, sq, ws, ns, 100, 0.95, 0.001)