check_weights {maicplus} | R Documentation |
Check to see if weights are optimized correctly
Description
This function checks to see if the optimization is done properly
by checking the covariate averages before and after adjustment.
In case of ties when calculating median,
we return the mean of the two numbers. For more details,
see ties
parameter in matrixStats::weightedMedian.
Usage
check_weights(weighted_data, processed_agd)
## S3 method for class 'maicplus_check_weights'
print(
x,
mean_digits = 2,
prop_digits = 2,
sd_digits = 3,
digits = getOption("digits"),
...
)
Arguments
weighted_data |
object returned after calculating weights using |
processed_agd |
a data frame, object returned after using |
x |
object from check_weights |
mean_digits |
number of digits for rounding mean columns in the output |
prop_digits |
number of digits for rounding proportion columns in the output |
sd_digits |
number of digits for rounding mean columns in the output |
digits |
minimal number of significant digits, see print.default. |
... |
further arguments to print.data.frame |
Value
data.frame of weighted and unweighted covariate averages of the IPD,
average of aggregate data, and sum of inner products of covariate x_i
and the weights (exp(x_i\beta)
)
Methods (by generic)
-
print(maicplus_check_weights)
: Print method for check_weights objects
Examples
data(weighted_sat)
data(agd)
check_weights(weighted_sat, process_agd(agd))