
Dispatch helper – calibrate to totals via "raking" or "greg".
Source:R/weights.R
morie_weights_calibrate_to_totals.RdDispatch helper – calibrate to totals via "raking" or "greg".
Usage
morie_weights_calibrate_to_totals(
weights,
df,
totals,
method = c("raking", "greg"),
...
)Arguments
- weights
Numeric vector of unit-level design weights.
- df
A
data.frameof unit-level covariates aligned withweights.- totals
Named numeric vector of calibration targets used by
calibrate_to_totals.- method
Character; calibration / smoothing / variance method. Allowed values depend on the caller.
- ...
Additional method-specific arguments.
Examples
set.seed(1)
df <- data.frame(g = rep(c("m", "f"), 15))
res <- morie_weights_calibrate_to_totals(rep(1, 30), df,
list(g = c(m = 50, f = 50)))
str(res, max.level = 1)
#> List of 5
#> $ weights : num [1:30] 1.67 1.67 1.67 1.67 1.67 ...
#> $ converged : logi TRUE
#> $ iterations : int 2
#> $ max_adjustment: num 0
#> $ diagnostics :List of 14