optimalClass: Classification Perspective

Description Usage Arguments Value References See Also Examples

View source: R/J_optimalClass.R

Description

Classification Perspective

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
optimalClass(
  ...,
  moPropen,
  moMain,
  moCont,
  moClass,
  data,
  response,
  txName,
  iter = 0L,
  fSet = NULL,
  verbose = TRUE
)

Arguments

...

Included to require named inputs

moPropen

An object of class modelObj, which defines the models and R methods to be used to obtain parameter estimates and predictions for the propensity for treatment. See ?moPropen for details.

moMain

An object of class modelObj, which defines the models and R methods to be used to obtain parameter estimates and predictions for for the main effects component of the outcome regression. See ?modelObj for details. NULL is an appropriate value.

moCont

An object of class modelObj, which defines the models and R methods to be used to obtain parameter estimates and predictions for for the contrasts component of the outcome regression. See ?modelObj for details. NULL is an appropriate value.

moClass

An object of class modelObj, which defines the models and R methods to be used to obtain parameter estimates and predictions for the classification. See ?modelObj for details.

data

A data frame of the covariates and tx histories

response

The response vector

txName

An character giving the column header of the column in data that contains the tx covariate.

iter

An integer See ?iter for details

fSet

A function or NULL. This argument allows the user to specify the subset of tx options available to a patient. See ?fSet for details of allowed structure

verbose

A logical If FALSE, screen prints are suppressed.

Value

an object of class OptimalClass

References

Baqun Zhang, Anastasios A. Tsiatis, Marie Davidian, Min Zhang and Eric B. Laber. "Estimating optimal tx regimes from a classification perspective." Stat 2012; 1: 103-114.

Note that this method is a single decision point, binary treatment method. For multiple decision points, can be called repeatedly.

See Also

Other statistical methods: bowl(), earl(), iqLearn, optimalSeq(), owl(), qLearn(), rwl()

Other single decision point methods: earl(), optimalSeq(), owl(), qLearn(), rwl()

Other multiple decision point methods: bowl(), iqLearn, optimalSeq(), qLearn()

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
# Load and process data set
data(bmiData)

# define the negative 12 month change in BMI from baseline
y12 <- -100*(bmiData[,6L] - bmiData[,4L])/bmiData[,4L]

# Define the propensity for treatment model and methods.
moPropen <- buildModelObj(model =  ~ 1, 
                          solver.method = 'glm', 
                          solver.args = list('family'='binomial'),
                          predict.method = 'predict.glm',
                          predict.args = list(type='response'))

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

#### Second-Stage Analysis using IPW
fitSS_IPW <- optimalClass(moPropen = moPropen, 
                          moClass = moClass,
                          data = bmiData, response = y12,  txName = 'A2')

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

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

#### Second-Stage Analysis using AIPW
fitSS_AIPW <- optimalClass(moPropen = moPropen, 
                           moMain = moMain, moCont = moCont,
                           moClass = moClass,
                           data = bmiData, response = y12,  txName = 'A2')

##Available methods

  # Retrieve the classification regression object
  classif(object = fitSS_AIPW)

  # Coefficients of the outcome regression objects
  coef(object = fitSS_AIPW)

  # Description of method used to obtain object
  DTRstep(object = fitSS_AIPW)

  # Estimated value of the optimal treatment regime for training set
  estimator(x = fitSS_AIPW)

  # Value object returned by outcome regression method
  fitObject(object = fitSS_AIPW)

  # Estimated optimal treatment and decision functions for training data
  optTx(x = fitSS_AIPW)

  # Estimated optimal treatment and decision functions for new data
  optTx(x = fitSS_AIPW, newdata = bmiData)

  # Value object returned by outcome regression method
  outcome(object = fitSS_AIPW)
  outcome(object = fitSS_IPW)

  # Plots if defined by outcome regression method
  dev.new()
  par(mfrow = c(2,4))

  plot(x = fitSS_AIPW)
  plot(x = fitSS_AIPW, suppress = TRUE)

  # Retrieve the value object returned by propensity regression method
  propen(object = fitSS_AIPW)

  # Show main results of method
  show(object = fitSS_AIPW)

  # Show summary results of method
  summary(object = fitSS_AIPW)
 
#### First-stage Analysis using AIPW

 # Define the propensity for treatment model and methods.
 moPropen <- buildModelObj(model =  ~ 1, 
                           solver.method = 'glm', 
                           solver.args = list('family'='binomial'),
                           predict.method = 'predict.glm',
                           predict.args = list(type='response'))

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

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

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

fitFS_AIPW <- optimalClass(moPropen = moPropen, 
                           moMain = moMain, moCont = moCont,
                           moClass = moClass,
                           data = bmiData, response = fitSS_AIPW,  
                           txName = 'A1')

##Available methods for fitFS_AIPW are as shown above for fitSS_AIPW

DynTxRegime documentation built on Nov. 10, 2020, 1:08 a.m.