dyntxregime
play

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


  1. 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

  2. Background Background Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 2 / 88

  3. Background Acknowledgements Innovative Methods Program for Advancing Clinical Trials A joint venture of Duke, UNC-Chapel Hill, and NC State Supported by NCI Program Project P01 CA142538 (2010-2021) http://impact.unc.edu Statistical methods for precision cancer medicine Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 3 / 88

  4. Background Goal DynTxRegime was envisioned to be a toolkit for all things related to estimating DTRs The guiding principles to its development are User-friendly straightforward, consistent inputs and post-processing General minimize artificial limitation of code choices Expandable design task oriented design (S4 dominated structure) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 4 / 88

  5. Background Goal DynTxRegime was envisioned to be a toolkit for all things related to estimating DTRs The guiding principles to its development are User-friendly straightforward, consistent inputs and post-processing General minimize artificial limitation of code choices Expandable design task oriented design (S4 dominated structure) Efficient? generalization first priority Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 5 / 88

  6. Background Key Challenge How to allow for general specification of regression steps? Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 6 / 88

  7. Background Key Challenge How to allow for general specification of regression steps? Our solution – the modelObj package. We start here Do you have the package installed? library(package = modelObj) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 7 / 88

  8. modelObj modelObj Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 8 / 88

  9. modelObj What is it? modelObj implements the design of a modeling object “modelObj” is a Class with state variables and behaviors The state variables define the model, method for obtaining parameter estimates, and method for obtaining predictions The only behavior is ’obtain parameter estimates’ Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 9 / 88

  10. modelObj How does it help? For developers, this paradigm separates the details of a regression step from its use in a method For users, this scheme encapsulates each regression step into a compact object Users interface with package modelObj through function buildModelObj() buildModelObj() is used to specify each regression step of the methods implemented in DynTxRegime Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 10 / 88

  11. buildModelObj() buildModelObj() Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 11 / 88

  12. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 12 / 88

  13. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) model : “formula”; the model Standard R “formula” object y ~ x Left-hand-side variable ignored; can (should) be omitted Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 13 / 88

  14. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) solver.method : “character”; name of the R function to be used to obtain parameter estimates ‘lm’, ‘glm’, ‘nls’ solver.args : “list”; additional arguments for solver.method Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 14 / 88

  15. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) solver.method : “character”; name of the R function to be used to obtain parameter estimates ‘lm’, ‘glm’, ‘nls’ solver.args : “list”; additional arguments for solver.method str(object = glm) function (formula, family = gaussian, data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = "glm.fit", x = FALSE, y = TRUE, singular.ok = TRUE, contrasts = NULL, ...) solver.args = list(family = “binomial”) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 15 / 88

  16. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) predict.method : “character”; name of the R function to be used to obtain predictions ‘predict.lm’, ‘predict.glm’, ‘predict’ predict.args : “list”; additional arguments for predict.method Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 16 / 88

  17. buildModelObj() str(object = buildModelObj) function (model, solver.method = NULL, solver.args = NULL, predict.method = NULL, predict.args = NULL) predict.method : “character”; name of the R function to be used to obtain predictions ‘predict.lm’, ‘predict.glm’, ‘predict’ predict.args : “list”; additional arguments for predict.method str(object = predict.glm) function (object, newdata = NULL, type = c("link", "response", "terms"), se.fit = FALSE, dispersion = NULL, terms = NULL, na.action = na.pass, ...) predict.args = list(type = “response”) Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 17 / 88

  18. buildModelObj() Example 1 Assume a dataset contains covariates ( x 1 , x 2 , x 3 ) and a continuous response variable y First - specify state variables Postulate model: y ∼ b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 Obtain parameter estimates using ordinary least square: lm() Obtain predictions: predict.lm() (dispatches predict() ) Use default settings of fitting function and prediction method Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 18 / 88

  19. buildModelObj() Example 1 Assume a dataset contains covariates ( x 1 , x 2 , x 3 ) and a continuous response variable y First - specify state variables Postulate model: y ∼ b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 Obtain parameter estimates using ordinary least square: lm() Obtain predictions: predict.lm() (dispatches predict() ) Use default settings of fitting function and prediction method Second - define model object buildModelObj(mode = ~x1+x2+x3, solver.method = "lm", predict.method = "predict.lm") Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 19 / 88

  20. buildModelObj() Example 2 Assume a dataset contains covariates ( x 1 , x 2 , x 3 ) and a binary response variable y First - specify state variables Postulate model: logit ( y ) ∼ b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 Obtain parameter estimates using ordinary least square: glm() Obtain predictions: predict.glm() (dispatches predict() ) Use default settings of fitting function and prediction method Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 20 / 88

  21. buildModelObj() Example 2 Assume a dataset contains covariates ( x 1 , x 2 , x 3 ) and a binary response variable y First - specify state variables Postulate model: logit ( y ) ∼ b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 Obtain parameter estimates using ordinary least square: glm() Obtain predictions: predict.glm() (dispatches predict() ) Use default settings of fitting function and prediction method Second - define model object buildModelObj(mode = ~x1+x2+x3, solver.method = "glm", solver.args = list(family = "binomial"), predict.method = "predict.glm") Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 21 / 88

  22. buildModelObj() There’s a lot more . . . We’ve glossed over a few details. For the applications in this class, they are not important. For the record: solver.method must have a corresponding predict.method It does not have to have coef() , residuals() , plot() , etc. Function specified in solver.method must take A “formula” object and a “data.frame” object; OR A design matrix (X) and a response vector (Y) Function specified by predict.method must take the regression value object and a “data.frame” object Can define your own regression and predictions methods. Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 22 / 88

  23. Requirements for modelObj in DynTxRegime Requirements for modelObj in DynTxRegime Shannon Holloway (Department of Statistics; NCSU) DynTxRegime September 10, 2020 23 / 88

Recommend


More recommend