Description Usage Arguments Details Value Author(s) References Examples
Estimate the plug-in value of a fixed treatment regime.
1 | plugInValue(optTx1, optTx2, response, tx1, tx2)
|
optTx1 |
Object of class |
optTx2 |
Object of class |
response |
Object of class |
tx1 |
Object of class |
tx2 |
Object of class |
The formula for the plug-in value estimate is
(∑_i Y_i*ind1_i*ind2_i)/(∑_i ind1_i*ind2_i)
where ind1 and ind2 are indicators that the first- and second-stage randomized treatments were consistent with the regime of interest.
value |
estimated plug-in value of the regime |
fixedReg |
estimated plug-in value of all possible fixed regimes |
Kristin A. Linn, Eric B. Laber, Leonard A. Stefanski, and Shannon T. Holloway <sthollow@ncsu.edu>
Laber, E.B., Linn, K.A., and Stefanski, L.A. (2014). Interactive Q-learning. Biometrika, in press.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | ##########################################################
# Load and process data set
##########################################################
data(bmiData)
#----------------------------------------------------#
# Recast treatment variables to (-1,1) --- required.
#----------------------------------------------------#
bmiData$A1[which (bmiData$A1=="MR")] <- 1L
bmiData$A1[which (bmiData$A1=="CD")] <- -1L
bmiData$A2[which (bmiData$A2=="MR")] <- 1L
bmiData$A2[which (bmiData$A2=="CD")] <- -1L
bmiData$A1 <- as.integer(bmiData$A1)
bmiData$A2 <- as.integer(bmiData$A2)
#----------------------------------------------------#
# define response y to be the negative 12 month
# change in BMI from baseline
#----------------------------------------------------#
bmiData$y <- -100*(bmiData[,6] - bmiData[,4])/bmiData[,4]
##########################################################
# Second-stage regression
##########################################################
#----------------------------------------------------#
# Create modeling object for main effect component
#----------------------------------------------------#
moMain <- buildModelObj(model = ~ gender + parentBMI + month4BMI,
solver.method = 'lm')
#----------------------------------------------------#
# Create modeling object for contrast component
#----------------------------------------------------#
moCont <- buildModelObj(model = ~ parentBMI + month4BMI,
solver.method='lm')
fitIQ2 <- iqLearnSS(moMain = moMain,
moCont = moCont,
data = bmiData,
response = bmiData$y,
txName = "A2",
iter = 0)
##########################################################
# Model conditional expected value of main effect term
##########################################################
#----------------------------------------------------#
# Create modeling object for main effect component
#----------------------------------------------------#
moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
solver.method = 'lm')
#----------------------------------------------------#
# Create modeling object for contrast component
#----------------------------------------------------#
form <-
moCont <- buildModelObj(model = ~ gender + parentBMI,
solver.method = 'lm')
fitIQ1main <- iqLearnFSM(moMain = moMain,
moCont = moCont,
response = fitIQ2,
data = bmiData,
txName = "A1",
iter = 100)
##########################################################
# Model conditional mean of contrast function
##########################################################
#----------------------------------------------------#
# Create modeling object for main effect component
#----------------------------------------------------#
form <-
moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
solver.method = 'lm')
#----------------------------------------------------#
# Create modeling object for contrast component
#----------------------------------------------------#
moCont <- buildModelObj(model = ~ gender + parentBMI + baselineBMI,
solver.method = 'lm')
fitIQ1cm <- iqLearnFSC(moMain = moMain,
moCont = moCont,
response = fitIQ2,
data = bmiData,
txName = "A1",
iter = 0)
##########################################################
# Variance Modeling
##########################################################
#----------------------------------------------------#
# Create modeling object for main effect component
#----------------------------------------------------#
moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
solver.method = 'lm')
#----------------------------------------------------#
# Create modeling object for contrast component #
#----------------------------------------------------#
moCont <- buildModelObj(model = ~ parentBMI + baselineBMI,
solver.method='lm')
fitIQ1var <- iqLearnFSV(object = fitIQ1cm,
moMain = moMain,
moCont = moCont,
data = bmiData,
txName = "A1",
iter = 100)
##########################################################
# Optimal Treatment for first stage
##########################################################
optimalTx <- optTx(x = fitIQ1main,
y = fitIQ1cm,
z = fitIQ1var,
dens = "nonpar")
##########################################################
# Plug-in Values
##########################################################
plugInValue(optTx1 = optimalTx$optimalTx,
optTx2 = optTx(fitIQ2)$optimalTx,
response = bmiData$y,
tx1 = bmiData$A1,
tx2 = bmiData$A2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.