Learn R Programming

DynTxRegime (version 3.2)

.newEARL: Efficient Augmentation and Relaxation Learning.

Description

Estimates the optimal treatment regime using Efficient Augmentation and Relaxation Learning. Method is not exported.

Usage

.newEARL(moPropen, moMain, moCont, ...)
# S4 method for modelObj,NULL,NULL
.newEARL(moPropen, moMain, moCont, data, response, txName, regime, lambdas, 
         cvFolds, surrogate, guess, txVec, suppress)
# S4 method for modelObj,modelObj,modelObj
.newEARL(moPropen, moMain, moCont, data, response, txName, regime, lambdas, 
         cvFolds, surrogate, iter, guess, txVec, suppress)
# S4 method for modelObj,modelObj,NULL
.newEARL(moPropen, moMain, moCont, data, response, txName, regime, lambdas, 
         cvFolds, surrogate, iter, guess, txVec, suppress)
# S4 method for modelObj,NULL,modelObj
.newEARL(moPropen, moMain, moCont, data, response, txName, regime, lambdas, 
         cvFolds, surrogate, iter, guess, txVec, suppress)

Arguments

moPropen

"modelObj" for propensity score modeling.

moMain

"modelObj" for main effects of outcome modeling.

moCont

"modelObj" for contrasts of outcome modeling.

...

Used to pass arguments that are required but the class of which does not determine the method that is selected.

data

"data.frame" of covariates and treatment history.

response

Outcome of interest.

txName

Treatment variable column header in data.

regime

"formula" description of decision function.

lambdas

Tuning parameter(s).

cvFolds

Number of cross-validation folds.

surrogate

"character" description of 0-1 loss surrogate.

iter

Maximum iterations for outcome regression iterative algorithm.

guess

Inital parameter guesses for optimization routine.

txVec

Treatment vector cast as +/- 1.

suppress

T/F indicating if prints to screen are executed.

Examples

Run this code
# NOT RUN {
data(bmiData)

y <- -(bmiData$month12BMI - bmiData$month4BMI) / bmiData$month4BMI * 100

moPropen <- buildModelObj(model = ~1, 
                          solver.method = 'glm',
                          solver.args = list("family" = "binomial"),
                          predict.args = list("type" = "response"))

moMain <- buildModelObj(model = ~ parentBMI + baselineBMI + month4BMI, 
                        solver.method = 'lm')

regime <- ~ parentBMI + baselineBMI + gender

txVec <- numeric(nrow(bmiData)) - 1L
txVec[bmiData$A2 == "MR"] <- 1L
bmiData$A2 <- as.factor(bmiData$A2)

obj <- DynTxRegime:::.newEARL(moPropen = moPropen,
                              moMain = NULL,
                              moCont = NULL,
                              data = bmiData,
                              response = y,
                              txName = "A2",
                              regime = regime,
                              lambdas = 0.1,
                              cvFolds = 0L,
                              surrogate = "hinge",
                              guess = NULL,
                              txVec = txVec,
                              suppress = TRUE)

is(obj)
coef(obj)
cvInfo(obj)
DTRstep(obj)
estimator(obj)
fitObject(obj)
optimObj(obj)
optTx(obj)
optTx(obj,bmiData)
outcome(obj)
print(obj)
propen(obj)
regimeCoef(obj)
show(obj)
summary(obj)

obj <- DynTxRegime:::.newEARL(moPropen = moPropen,
                              moMain = moMain,
                              moCont = moMain,
                              data = bmiData,
                              response = y,
                              txName = "A2",
                              regime = regime,
                              lambdas = c(0.1,0.2),
                              cvFolds = 4L,
                              surrogate = "hinge",
                              guess = NULL,
                              txVec = txVec,
                              iter = 0L,
                              suppress = TRUE)

is(obj)
coef(obj)
cvInfo(obj)
DTRstep(obj)
estimator(obj)
fitObject(obj)
optimObj(obj)
optTx(obj)
optTx(obj,bmiData)
outcome(obj)
print(obj)
propen(obj)
regimeCoef(obj)
show(obj)
summary(obj)

# }

Run the code above in your browser using DataLab