A generic function used to weight data using estimated propensity scores. Six separate propensity score methods can be employed: (i) inverse probability weighting for the average treatment effect on the treated (IPTW-ATT weighting), (ii) IPTW-ATT weighting where controls with predicted propensity scores less than the 1st percentile or greater than the 99th percentile are trimmed (i.e., excluded), (iii) 1:1 nearest neighbor matching without a caliper, (iv) 1:1 nearest neighbor matching with a caliper (of 0.25 standard deviations of the linear propensity score), (v) 1:1 genetic matching without a caliper, and (vi) 1:1 genetic matching with a caliper. Matching is always performed without replacement unless the number of controls is less then the number of treated (in which case it is performed with replacement). Unadjusted (i.e., unweighted) results are also always returned.

psweight(object, ...)

# S3 method for ps
psweight(
  object,
  methods = c("iptw_att", "iptw_att_trim", "match_nearest", "match_nearest_caliper"),
  ...
)

# S3 method for ps_mi
psweight(object, ...)

# S3 method for list
psweight(object, progress = FALSE, outfile = "psweight_out", ...)

Arguments

object

An object of the appropriate class containing the propensity score to match on and other relevant information.

...

Additional arguments to pass to Matching::GenMatch().

methods

The propensity score methods to use. Can select any combination of the available methods. The default is to use IPTW-ATT weighting (with and without trimming) and nearest neighbor matching (with and without a caliper). Genetic matching can be employed using the options match_genetic and match_genetic_caliper.

progress

Logical. If TRUE, the the iteration number from the list is printed to the screen and save to the outfile.

outfile

File path when progress = TRUE.

Value

A dplyr::tibble is always returned that contains (i) each variable included in data, (ii) the columns ps and logit_ps and for the propensity score and logit of the propensity score, respectively, (iii) the column weight for the weight generated, (iv) the column method for the propensity score method used, (v) the column exclude denoting whether patients were excluded using either trimming or a caliper, and (vi) the column method_type for the type of propensity score method (weighting, matching, or none).

The returned object always inherits from dplyr::tibble but the class depends on object. If object is of class ps_fit, then there is one row for each patient and the returned object is of class psweight. If object is of class ps_fit_mi, then an additional column imp is added for the imputation number and an object of class psweight_mi is returned. Finally, if object is of class list, then an additional column grp is added and an object of class grouped_psweight or grouped_psweight_mi is returned.