Description Usage Arguments Value
Finds weights that exactly calibrate first order margins between respondents and the target population. Requires individual-level of cell-level data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
formula |
Formula of the form |
target_count |
Name of column with indicators for whether an individual is in the target population (with individual-level data) or the target counts for each cell (with cell-level data) |
data |
Dataframe with covariate information, sample and target counts |
order |
Integer. What order interactions to balance. Default is all orders |
lambda |
Numeric. Regularization hyperparamter, by default fits weights for a range of values |
lambda_max |
Numeric. Maximum hyperparameter to fit weights with, default is the root sum of squared differences between the (unweighted) sample and the target |
n_lambda |
Integer. Number of hyper-parameters to fit weights for, from lambda_max to lambda_max * lambda_min_ratio, equally spaced on the log scale. Default, 20 |
lambda_min_ratio |
Numeric. Ratio of min to max lambda to consider. |
lowlim |
Lower bound on weights, default 0 |
uplim |
Upper bound on weights, default Inf |
verbose |
Boolean. Show optimization information, default False |
... |
Additional parameters for osqp |
data frame with the weight for each distinct cell, for each value of
the hyperparameter lambda
. Note: the output data frame may have the
cells in a different order than in data
. Be sure to join the output
with data
on the variables to map the weights to the data accurately.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.