Skip to contents

This function checks to see if the optimization is done properly by checking the covariate averages before and after adjustment.

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

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))
#>   covariate match_stat internal_trial internal_trial_after_weighted
#> 1       AGE       Mean         59.850                         51.00
#> 2       AGE     Median         59.000                         49.00
#> 3       AGE         SD          9.011                          3.25
#> 4  SEX_MALE       Prop          0.380                          0.49
#> 5     ECOG0       Prop          0.410                          0.35
#> 6     SMOKE       Prop          0.320                          0.19
#>   external_trial sum_centered_IPD_with_weights
#> 1          51.00                        0.0000
#> 2          49.00                        0.0000
#> 3           3.25                       -0.0045
#> 4           0.49                        0.0000
#> 5           0.35                        0.0000
#> 6           0.19                        0.0000