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"),
  .drop_arg_fml = FALSE,
  ...
)

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.

.drop_arg_fml

internal use to drop arguments and call, this is only used in cjk.

...

Additional parameters for matching

Value

A list of class PSRWE_DTA_MAT with items:

data

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

ps_fml

PS formula for estimated PS scores.

nstrata

Number of strata.

ratio

Matching 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")

## With neighest neighbor
.remark_nnmatch <- function() {
  dta_ps_mat <- psrwe_match(dta_ps, ratio = 2, strata_covs = "V1",
                            seed = 123)
  dta_ps_mat
}
## Unmark below to run
# .remark_nnmatch()

## 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()


olssol/psrwe documentation built on July 17, 2024, 4:06 p.m.