get_current_miss | R Documentation |
This function calculates the extent to which the data under the current weighting scheme diverges from the target proportions, according to any error function.
get_current_miss(data, target, weights = rep(1, nrow(data)),
error_function = current_miss_linear)
data |
A data frame (tibble) or matrix containing the variables being
targeted. Additional variables can be present in |
target |
As with |
weights |
The current weights; if left blank, all units will be assigned weight 1 and this will show imbalance in the original sample. |
error_function |
Specification of error function (how we measure how
far off a variable is from its intended result). Valid
|
A named vector containing the degree of error, whose names are the
variables supplied in the order they were present in target
## Not run:
# Can be used for data without weights to see initial error
get_current_miss(respondent_data, ns_target)
# Supply weights
result <- harvest(respondent_data, ns_target)
get_current_miss(respondent_data, ns_target, result$weights)
# By default, the error function adds the linear errors across levels of
# the target proportions.
get_current_miss(respondent_data, ns_target, error_function = "max")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.