DynTxRegime
An R Package for Dynamic Treatment Regimes Shannon Holloway
Department of Statistics; NCSU
September 10, 2020
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 1 / 88
DynTxRegime An R Package for Dynamic Treatment Regimes Shannon - - PowerPoint PPT Presentation
DynTxRegime An R Package for Dynamic Treatment Regimes Shannon Holloway Department of Statistics; NCSU September 10, 2020 Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 1 / 88 Background Background
Department of Statistics; NCSU
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 1 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 2 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 3 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 4 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 5 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 6 / 88
Background
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 7 / 88
modelObj
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 8 / 88
modelObj
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 9 / 88
modelObj
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 10 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 11 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 12 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 13 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 14 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 15 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 16 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 17 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 18 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 19 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 20 / 88
buildModelObj()
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 21 / 88
buildModelObj()
A “formula” object and a “data.frame” object; OR A design matrix (X) and a response vector (Y)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 22 / 88
Requirements for modelObj in DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 23 / 88
Requirements for modelObj in DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 24 / 88
Requirements for modelObj in DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 25 / 88
Requirements for modelObj in DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 26 / 88
Requirements for modelObj in DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 27 / 88
Toy Dataset
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 28 / 88
Toy Dataset
summary(object = df) x1 x2 x3 Min. :-3.40000 Min. :0.000 Min. : 0.640 1st Qu.:-0.67000 1st Qu.:0.000 1st Qu.: 7.997 Median :-0.04000 Median :0.000 Median :10.120 Mean :-0.02656 Mean :0.306 Mean :10.072 3rd Qu.: 0.62000 3rd Qu.:1.000 3rd Qu.:12.105 Max. : 3.20000 Max. :1.000 Max. :19.500 A y Min. :0.000 Min. :-5.0600 1st Qu.:0.000 1st Qu.:-1.3100 Median :0.000 Median :-0.3000 Mean :0.499 Mean :-0.3138 3rd Qu.:1.000 3rd Qu.: 0.7025 Max. :1.000 Max. : 3.9900
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 29 / 88
DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 30 / 88
DynTxRegime
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 31 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 32 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 33 / 88
DynTxRegime Outcome Regression (Q-Learning)
µ
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 34 / 88
DynTxRegime Outcome Regression (Q-Learning)
µ
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 35 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 36 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 37 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 38 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 39 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 40 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 41 / 88
DynTxRegime Outcome Regression (Q-Learning) fitObj <- fitObject(object = qObj) fitObj $outcome $outcome$Combined Call: lm(formula = YinternalY ~ x1 + x2 + A + x2:A + A:x3, data = data) Coefficients: (Intercept) x1 x2 A 0.08323 0.74739 0.21868 0.99709 x2:A A:x3 0.31114
is(object = fitObj$outcome$Combined) [1] "lm" "oldClass" utils::methods(class = is(object = fitObj$outcome$Combined)[1L]) [1] add1 alias anova [4] case.names coerce confint [7] cooks.distance deviance dfbeta [10] dfbetas drop1 dummy.coef [13] effects extractAIC family [16] formula hatvalues influence [19] initialize kappa labels [22] logLik model.frame model.matrix [25] nobs plot predict [28] print proj qr [31] residuals rstandard rstudent [34] show simulate slotsFromS3 [37] summary variable.names vcov see '?methods' for accessing help and source code Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 42 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 43 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 44 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 45 / 88
DynTxRegime Outcome Regression (Q-Learning)
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 46 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 47 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 48 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 49 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 50 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 51 / 88
DynTxRegime Value Search
µ
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 52 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 53 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 54 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 55 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 56 / 88
DynTxRegime Value Search vsObj <- optimalSeq(moPropen = moPropen, moMain = moMain, moCont = moCont, iter = 0L, data = df, response = df$y, txName = 'A', regimes = regimes, Domains = matrix(data = c(-10,-10,10,10), ncol = 2L), starting.values = c(0,0), pop.size = 500, verbose = TRUE) Value Search - Missing Data Perspective. Propensity for treatment regression. Regression analysis for moPropen: Call: glm(formula = YinternalY ~ 1, family = "binomial", data = data) Coefficients: (Intercept)
Degrees of Freedom: 999 Total (i.e. Null); 999 Residual Null Deviance: 1386 Residual Deviance: 1386 AIC: 1388 Outcome regression. Combined outcome regression model: ~ x1+x2 + A + A:(x2+x3) . Regression analysis for Combined: Call: lm(formula = YinternalY ~ x1 + x2 + A + x2:A + A:x3, data = data) Coefficients: (Intercept) x1 x2 A 0.08323 0.74739 0.21868 0.99709 x2:A A:x3 0.31114
Wed Sep 9 17:34:34 2020 Domains:
<= X1 <= 1.000000e+01
<= X2 <= 1.000000e+01 Data Type: Floating Point Operators (code number, name, population) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 57 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 58 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 59 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 60 / 88
DynTxRegime Value Search fitObj <- fitObject(object = vsObj) print(x = fitObj) $propensity Call: glm(formula = YinternalY ~ 1, family = "binomial", data = data) Coefficients: (Intercept)
Degrees of Freedom: 999 Total (i.e. Null); 999 Residual Null Deviance: 1386 Residual Deviance: 1386 AIC: 1388 $outcome $outcome$Combined Call: lm(formula = YinternalY ~ x1 + x2 + A + x2:A + A:x3, data = data) Coefficients: (Intercept) x1 x2 A 0.08323 0.74739 0.21868 0.99709 x2:A A:x3 0.31114
is(object = fitObj$propensity) [1] "glm" "lm" "oldClass" is(object = fitObj$outcome$Combined) [1] "lm" "oldClass" Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 61 / 88
DynTxRegime Value Search genetic(object = vsObj) $value [1] 0.1534204 $par [1] 0.4259397 4.6884133 $gradients [1] NA NA $generations [1] 12 $peakgeneration [1] 1 $popsize [1] 500 $operators [1] 65 62 62 62 62 62 62 62 Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 62 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 63 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 64 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 65 / 88
DynTxRegime Value Search
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 66 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 67 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 68 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 69 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 70 / 88
DynTxRegime Classification
µ
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 71 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 72 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 73 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 74 / 88
DynTxRegime Classification clObj <- optimalClass(moPropen = moPropen, moMain = moMain, moCont = moCont, iter = 0L, moClass = moClass, data = df, response = df$y, txName = 'A', verbose = TRUE) AIPW value estimator First step of the Classification Algorithm. Classification Perspective. Propensity for treatment regression. Regression analysis for moPropen: Call: glm(formula = YinternalY ~ 1, family = "binomial", data = data) Coefficients: (Intercept)
Degrees of Freedom: 999 Total (i.e. Null); 999 Residual Null Deviance: 1386 Residual Deviance: 1386 AIC: 1388 Outcome regression. Combined outcome regression model: ~ x1+x2 + A + A:(x2+x3) . Regression analysis for Combined: Call: lm(formula = YinternalY ~ x1 + x2 + A + x2:A + A:x3, data = data) Coefficients: (Intercept) x1 x2 A 0.08323 0.74739 0.21868 0.99709 x2:A A:x3 0.31114
Classification Analysis Regression analysis for moClass: n= 1000 Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 75 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 76 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 77 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 78 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 79 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 80 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 81 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 82 / 88
DynTxRegime Classification
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 83 / 88
DynTxRegime Outcome Weighted Learning
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 84 / 88
DynTxRegime Outcome Weighted Learning
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 85 / 88
DynTxRegime Outcome Weighted Learning
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 86 / 88
DynTxRegime Conclusion
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 87 / 88
DynTxRegime Conclusion
Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 88 / 88