predict | R Documentation |
Method to estimate the value for new data or to retrieve estimated value for training data
## S4 method for signature 'DTRSurv' predict(object, ..., newdata, stage = 1, findOptimal = TRUE)
object |
A DTRSurv object. The object returned by a call to dtrSurv(). |
... |
Ignored. Used to require named inputs. |
newdata |
NULL or a data.frame object. If NULL, this method retrieves the estimated value for the training data. If a data.frame, the value is estimated based on the data provided. |
stage |
An integer object. The stage for which predictions are desired. |
findOptimal |
A logical object. If TRUE, the value is estimated for all treatment options and that leading to the maximum value for each individual is used to estimate the value. |
a list object containing a matrix of the predicted survival function (survFunc), the estimated mean survuval (mean), and the estimated survival probability (if critical value is surv.mean or surv.prob)
dt <- data.frame("Y.1" = sample(1:100,100,TRUE), "Y.2" = sample(101:200,100,TRUE), "D.1" = rbinom(100, 1, 0.9), "D.2" = rbinom(100,1,0.9), "A.1" = rbinom(100, 1, 0.5), "A.2" = rbinom(100,1,0.5), "X.1" = rnorm(100), "X.2" = rnorm(100)) result <- dtrSurv(data = dt, txName = c("A.1", "A.2"), models = list(Surv(Y.1,D.1)~X.1+A.1, Surv(Y.2,D.2)~X.2+A.2+Y.1)) tt <- predict(object = result) tt <- predict(object = result, stage = 1) tt <- predict(object = result, findOptimal = FALSE) tt <- predict(object = result, newdata = dt) tt <- predict(object = result, newdata = dt, stage = 1) tt <- predict(object = result, newdaata = dt, findOptimal = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.