exmWt.2ipd {maicChecks} | R Documentation |
Exact matching for two IPD's
Description
Exact matching for two IPD's
Usage
exmWt.2ipd(
ipd1,
ipd2,
vars_to_match = NULL,
cat_vars_to_01 = NULL,
mean.constrained = FALSE
)
Arguments
ipd1 |
a dataframe with n row and p column, where n is number of subjects and p is the number of variables used in matching. |
ipd2 |
the other IPD with the same number of columns |
vars_to_match |
variables used for matching. if NULL, use all variables. |
cat_vars_to_01 |
a list of variable names for the categorical variables that need to be converted to indicator variables. |
mean.constrained |
whether to restrict the weighted means to be within the ranges of observed means. Default is FALSE. When it is TRUE, there is a higher chance of not having a solution. |
Details
If dummy variables are already created for the categorical variables in the data set, and are present in ipd1
and ipd2
, then cat_vars_to_01
should be left as NULL.
Value
ipd1 |
re-scaled weights of the exact matching by maximizing ESS for IPD 1, and the input IPD 1 data with categorical variables converted to 0-1 indicators |
ipd2 |
re-scaled weights of the exact matching by maximizing ESS for IPD 2, and the input IPD 2 data with categorical variables converted to 0-1 indicators |
wtd.summ |
ESS for IPD 1, ESS for IPD 2, and weighted means of the matching variables |
Author(s)
Lillian Yau
Examples
## Not run:
ipd1 <- sim110[sim110$study == 'IPD A',]
ipd2 <- sim110[sim110$study == 'IPD B',]
x <- exmWt.2ipd(ipd1, ipd2, vars_to_match = paste0('X', 1:5),
cat_vars_to_01 = paste0('X', 1:3), mean.constrained = FALSE)
## End(Not run)