Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


maicChecks (version 0.2.0)

exmLP.2ipd: Checks whether two IPD datasets can be matched with lpSolve::lp

Description

Checks whether two IPD datasets can be matched with lpSolve::lp

Usage

exmLP.2ipd(
  ipd1,
  ipd2,
  vars_to_match = NULL,
  cat_vars_to_01 = NULL,
  mean.constrained = FALSE
)

Value

lp.check

0 = OS can be conducted; 2 = OS cannot be conducted

Arguments

ipd1

a dataframe with n1 row and p column, where n1 is number of subjects of the first IPD, and p is the number of variables used in standardization.

ipd2

a dataframe with n2 row and p column, where n2 is number of subjects of the second IPD, and p is the number of variables used in standardization.

vars_to_match

variables used for matching. if NULL, use all variables.

cat_vars_to_01

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.

Author

Lillian Yau

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.

Examples

Run this code
if (FALSE) {
ipd1 <- sim110[sim110$study == 'IPD A',]
ipd2 <- sim110[sim110$study == 'IPD B',]
x <- exmLP.2ipd(ipd1, ipd2, vars_to_match = paste0('X', 1:5), 
cat_vars_to_01 = paste0('X', 1:3), mean.constrained = FALSE) 
}

Run the code above in your browser using DataLab