Learn R Programming

DynTxRegime (version 3.01)

.newOWL: Outcome Weighted Learning.

Description

Estimates the optimal treatment regime using outcome weighted learning. Method is not exported.

Usage

.newOWL(moPropen,...)
# S4 method for modelObj
.newOWL(moPropen, data, reward, txName, regime, lambdas, cvFolds, kernel,
        kparam, txVec, suppress)

Arguments

moPropen
"modelObj" for propensity score 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.
reward
Vector of reward.
txName
Treatment variable column header in data.
regime
"formula" description of decision function.
lambdas
Tuning parameter(s).
cvFolds
Number of cross-validation folds.
kernel
"character" description of kernel function.
kparam
"numeric" parameter for kernel function.
txVec
Treatment vector cast as +/- 1.
suppress
T/F indicating if prints to screen are executed.

Examples

Run this code

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

regime <- ~ parentBMI + baselineBMI + gender

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

obj <- DynTxRegime:::.newOWL(moPropen = moPropen,
                             data = bmiData,
                             reward = y,
                             txName = "A2",
                             regime = regime,
                             lambdas = 0.1,
                             cvFolds = 0L,
                             kernel = "linear",
                             kparam = 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:::.newOWL(moPropen = moPropen,
                             data = bmiData,
                             reward = y,
                             txName = "A2",
                             regime = regime,
                             lambdas = c(0.1,0.2),
                             cvFolds = 4L,
                             kernel = "linear",
                             kparam = 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:::.newOWL(moPropen = moPropen,
                             data = bmiData,
                             reward = y,
                             txName = "A2",
                             regime = regime,
                             lambdas = c(0.1,0.2),
                             cvFolds = 4L,
                             kernel = "radial",
                             kparam = c(1.0,2.0),
                             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:::.newOWL(moPropen = moPropen,
                             data = bmiData,
                             reward = y,
                             txName = "A2",
                             regime = regime,
                             lambdas = 0.1,
                             cvFolds = 4L,
                             kernel = "radial",
                             kparam = c(1.0,2.0),
                             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)

Run the code above in your browser using DataLab