Learn R Programming

DynTxRegime (version 3.01)

.newOptimalClass: Optimal Treatment Regime from Classification Perspective.

Description

Estimates the optimal treatment from the classification perspective. Method is not exported.

Usage

.newOptimalClass(moPropen, moMain, moCont, moClass,...)
# S4 method for modelObj,NULL,NULL,modelObj
.newOptimalClass(moPropen,moMain,moCont,moClass,data,response,txName,suppress)
# S4 method for modelObj,modelObj,modelObj,modelObj
.newOptimalClass(moPropen,moMain,moCont,moClass,data,response,txName,iter,suppress)
# S4 method for modelObj,modelObj,NULL,modelObj
.newOptimalClass(moPropen,moMain,moCont,moClass,data,response,txName,iter,suppress)
# S4 method for modelObj,NULL,modelObj,modelObj
.newOptimalClass(moPropen,moMain,moCont,moClass,data,response,txName,iter,suppress)

Arguments

moPropen
"modelObj" for propensity score regression.
moMain
"modelObj" for main effects of outcome regression.
moCont
"modelObj" for contrasts of outcome regression.
moClass
"modelObj" for classification.
...
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
"character" name of column header in data containing treatment variable.
iter
Maximum number of iterations for iterative algorithm.
suppress
T/F indicating if screen prints are generated.

Examples

Run this code

data(bmiData)
library(rpart)

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

bmiData$A2 <- as.factor(bmiData$A2)

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')
moCont <- buildModelObj(model = ~parentBMI+baselineBMI+month4BMI, 
                        solver.method = 'lm')

moClass <- buildModelObj(model = ~parentBMI+baselineBMI+month4BMI, 
                         solver.method = 'rpart',
                         predict.args = list("type"="class"))


obj <- DynTxRegime:::.newOptimalClass(moPropen = moPropen,
                                      moMain = NULL, 
                                      moCont = NULL, 
                                      moClass = moClass,
                                      data = bmiData,
                                      response = y,
                                      txName = 'A2', 
                                      suppress = TRUE)

is(obj)

coef(obj)
DTRstep(obj)
estimator(obj)
fitObject(obj)
optTx(obj)
optTx(obj,bmiData)
outcome(obj)
plot(obj)
propen(obj)
show(obj)
summary(obj)

obj <- DynTxRegime:::.newOptimalClass(moPropen = moPropen,
                                      moMain = moMain, 
                                      moCont = moCont, 
                                      moClass = moClass,
                                      data = bmiData,
                                      response = y,
                                      txName = 'A2', 
                                      iter = 0L,
                                      suppress = TRUE)

is(obj)

coef(obj)
DTRstep(obj)
estimator(obj)
fitObject(obj)
optTx(obj)
optTx(obj,bmiData)
outcome(obj)
plot(obj)
propen(obj)
show(obj)
summary(obj)

Run the code above in your browser using DataLab