psrwe_match: PS matching

View source: R/psrwe_ps_match.R

psrwe_matchR Documentation

PS matching

Description

Match patients in external data source with patients in current study based on PS using nearest neighbor method.

Usage

psrwe_match(
  dta_ps,
  ratio = 3,
  strata_covs = NULL,
  caliper = 1,
  seed = NULL,
  method = c("nnwor", "optm"),
  ...
)

Arguments

dta_ps

A list of class PSRWE_DAT that is generated using the psrwe_est function.

ratio

Matching ratio (RWD : Current) with default value 3 meaning 3:1 matching.

strata_covs

Stratification covariates for matching.

caliper

PS matching caliper width. Default 1. This specifies a width (euclidean distance) on the probability scale.

seed

Random seed.

method

matching algorithm for PS matching.

...

Additional parameters for matching

Value

A list of class PSRWE_DTA_MAT with items:

  • dataOriginal data with column _ps_ for estimated PS scores, match_id for matched current study subject ID, and _strata_ for PS stratum added.

  • ps_fmlPS formula for estimated PS scores.

  • nstrataNumber of strata.

  • ratioMatching ratio.

Examples

data(ex_dta)
dta_ps <- psrwe_est(ex_dta,
                     v_covs = paste("V", 1:7, sep = ""),
                     v_grp = "Group",
                     cur_grp_level = "current")
dta_ps_mat <- psrwe_match(dta_ps, ratio = 2, strata_covs = "V1",
                           seed = 123)
dta_ps_mat

## With optmatch
.remark_optmatch <- function() {
    warning("The optmatch package may restrict use (academic license).")
    dta_ps_opt <- psrwe_match(dta_ps, ratio = 2,
                               strata_covs = "V1",
                               method = "optm", seed = 123)
    dta_ps_opt
}
## Unmark below to run if optmatch is available.
# .remark_optmatch()


psrwe documentation built on March 18, 2022, 5:33 p.m.