single_adjust | R Documentation |
This function internally rakes the weights provided according to the
current imbalance in a single variable. The mathematical process here is
simple: for each level of the variable, multiply the weight by the target
proportion divided by the current weighted proportion. For instance, if a
party
variable should be 0.4 Independent, 0.35 Democratic, and 0.25
Republican, and the current weighted proportion is 0.4 Democratic, then the
weights of every Democrat will be multiplied by 0.35 / 0.4. This is an
internal function and not intended for end-users.
single_adjust(data, weights, target, var, cache)
data |
The data frame (tibble) or matrix which contains the original data. |
weights |
The current weights |
target |
The target proportions, specified as in |
var |
A quoted character vector containing the variable we are currently raking on. |
cache |
A list of integer vectors mapping rows of the data frame to levels of the target variable |
Adjusted weights, raked for this variable.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.