View source: R/psrwe_ps_match.R
| psrwe_match | R Documentation |
Match patients in external data source with patients in current study based on PS using nearest neighbor method.
psrwe_match(
dta_ps,
ratio = 3,
strata_covs = NULL,
caliper = 1,
seed = NULL,
method = c("nnwor", "optm"),
...
)
dta_ps |
A list of class |
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 |
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.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.