Learn R Programming

maicplus (version 0.1.2)

check_weights: 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 maicplus_check_weights print( x, mean_digits = 2, prop_digits = 2, sd_digits = 3, digits = getOption("digits"), ... )

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)\))

Arguments

weighted_data

object returned after calculating weights using estimate_weights

processed_agd

a data frame, object returned after using process_agd or aggregated data following the same naming convention

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

Methods (by generic)

  • print(maicplus_check_weights): Print method for check_weights objects

Examples

Run this code
data(weighted_sat)
data(agd)
check_weights(weighted_sat, process_agd(agd))

Run the code above in your browser using DataLab