Description Usage Arguments Details Value Author(s) References Examples
Implements a classification based alternative to Q- and A- learning that uses an Augmented Inverse Probability Weighted Estimator (AIPWE) or an Inverse Probability Weighted Estimator (IPWE) of the contrast function to define a weighted classification problem. The method is limited to single decision point binary treatment regimes.
1 2 | optimalClass(..., moPropen, moMain, moCont, moClass,
data, response, txName, iter=0L, suppress = FALSE)
|
... |
ignored. |
moPropen |
an object of class moPropen objects differ slightly from the standard modelObj in that an additional predict.args element may be required. In the list of control parameters passed to the prediction method, an additional list element, "propenMissing" can be included. This element takes value "smallest" or "largest". If the prediction method specified in moPropen returns predictions for only a subset of the treatment data, propenMissing indicates whether it is the smallest or the largest treatment value that is missing, or base case. For example, fitting a binary tx using moPropen@predict.method <- predict.glm moPropen@predict.args <- list(type='response') returns only P(A=1). P(A=0) is "missing", and thus moPropen@predict.args <- list("type"="response", "propenMissing" = "smallest") If the dimension of the value returned by the prediction method is less than the number of treatment options and no value is provided in propenMissing, it is assumed that the smallest valued treatment option is missing. |
moMain |
an object of class |
moCont |
an object of class |
moClass |
an object of class |
data |
an object of class |
response |
an object of class |
txName |
an object of class |
iter |
an object of class >=1 if <=0 if the components of the conditional expectation
|
suppress |
an object of class |
A single decision point dynamic treatment regime is a decision rule for assigning treatment based on a patient's history. Several regression based approaches have been developed to estimate the "optimal dynamic treatment regime". 'optimalClass' is an alternative approach that uses a doubly robust Augmented Inverse Probability Weighted estimator (AIPWE) or an Inverse Probability Weighted estimator (IPWE) for the contrast function to define a weighted classification problem. The resulting classifications scheme defines the optimal treatment regime.
The user provides a model for the propensity for treatment and a model for the main effects and contrasts of the conditional expectation of the outcome given treatment and covariates. Parameter estimates for these models are obtained using available R methods as specified by the user. The AIPWE contrast function is defined by the fitted models and is used to define a weighted classification problem. The R method to fit the classification problem is specified by the user with some limitations.
The user can opt for the IPWE estimator by specifying moMain and moCont as NULL.
Generally speaking, there are few limitations on the models that can be employed. However, classification methods must also accept "weights" as a formal argument. In addition, predict methods must return predictions on the scale of the response for propensity and conditional expectations and on the scale of class for the classification methods.
Returns an object that inherits directly from class DynTxRegime
.
Baqun Zhang, Anastasios A. Tsiatis, Eric B. Laber, Min Zhang, Marie Davidian, and Shannon T. Holloway sthollow@ncsu.edu
Zhang, B., Tsiatis, A. A., Davidian, M., Zhang, M., and Laber, E. B. (2012). Estimating Optimal Treatment Regimes from a Classification Perspective. Stat, 1, 103–114
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 | #------------------------------------------------------------------------------#
#This is simulation study #1 described in Stat 2012; 1: 103-114.
#------------------------------------------------------------------------------#
library(MASS)
library(rpart)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#Generate data
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
expit <- function(x) { exp(x)/(1+exp(x)) }
n <- 200
means <- rep(0,5)
vmat <- matrix(0,nrow=5,ncol=5) + diag(5)
X <- data.frame(mvrnorm(n,means,vmat))
p1 <- expit(-0.1 + 0.5*X$X1 + 0.5*X$X2)
a <- rbinom(n=n, size=1, prob=p1)
tg <- I(X$X1 > -0.545) * I( X$X2 < 0.545)
means <- exp( 2 + 0.25*X$X1 + 0.25*X$X2 - 0.25*X$X5 - 0.3*(a-tg)^2)
y <- sapply(means,function(x){rnorm(n=1, mean=x, sd=1)})
df <- data.frame(X,a)
colnames(df) <- c("x1", "x2", "x3", "x4", "x5", "a1")
#--------------------------------------------------------------------------#
# Define the propensity for treatment model and methods.
#--------------------------------------------------------------------------#
propen <- buildModelObj(model = ~ x1 + x2,
solver.method = 'glm',
solver.args = list('family'='binomial'),
predict.method = 'predict.glm',
predict.args = list(type='response'))
#--------------------------------------------------------------------------#
# Define the conditional expectation model.
#--------------------------------------------------------------------------#
expec.main <- buildModelObj(model = ~x1+x2+x3+x4+x5,
solver.method = 'lm')
expec.cont <- buildModelObj(model = ~x1+x2+x3+x4+x5,
solver.method = 'lm')
#--------------------------------------------------------------------------#
# Define the classification model.
#--------------------------------------------------------------------------#
class <- buildModelObj(model = ~x1 + x2 + x3 + x4 + x5,
solver.method = 'rpart',
solver.args = list(method="class"),
predict.args = list(type='class'))
#--------------------------------------------------------------------------#
# Specify the column index of df corresponding to the treatment covariate
#--------------------------------------------------------------------------#
tx.vars <- "a1"
estAIPWE <- optimalClass(moPropen = propen,
moMain = expec.main,
moCont = expec.cont,
moClass = class,
data = df,
response = y,
txName = tx.vars,
iter=0)
estimator(estAIPWE)
classif(estAIPWE)
outcome(estAIPWE)
propen(estAIPWE)
head(optTx(estAIPWE))
estIPWE <- optimalClass(moPropen = propen,
moMain = NULL,
moCont = NULL,
moClass = class,
data = df,
response = y,
txName = tx.vars,
iter=0)
estimator(estIPWE)
classif(estIPWE)
propen(estIPWE)
head(optTx(estIPWE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.