predict.cox.adapt {extremefit} | R Documentation |
Predict the survival or quantile function from the extreme procedure for the Cox model
Description
Give the survival or quantile function from the extreme procedure for the Cox model
Usage
## S3 method for class 'cox.adapt'
predict(object, newdata = NULL, input = NULL,
type = "quantile", aggregation = "none", AggInd = object$kadapt,
M = 10, ...)
Arguments
object |
output object of the function cox.adapt. |
newdata |
a data frame with which to predict. |
input |
optionnaly, the name of the variable to estimate. |
type |
either "quantile" or "survival". |
aggregation |
either "none", "simple" or "adaptive". |
AggInd |
Indices of thresholds to be aggregated. |
M |
Number of thresholds to be aggregated. |
... |
further arguments passed to or from other methods. |
Details
newdata
must be a data frame with the co-variables from which to predict and a variable of probabilities with its name starting with a "p" if type = "quantile" or a variable of quantiles with its name starting with a "x" if type = "survival".
The name of the variable from which to predict can also be written as input
.
Value
The function provide the quantile assiociated to the adaptive model for the probability grid if type = "quantile". And the survival function assiociated to the adaptive model for the quantile grid if type = "survival".
See Also
Examples
library(survival)
data(bladder)
X <- bladder2$stop-bladder2$start
Z <- as.matrix(bladder2[, c(2:4, 8)])
delta <- bladder2$event
ord <- order(X)
X <- X[ord]
Z <- Z[ord,]
delta <- delta[ord]
cph<-coxph(Surv(X, delta) ~ Z)
ca <- cox.adapt(X, cph, delta, bladder2[ord,])
xgrid <- X
newdata <- as.data.frame(cbind(xgrid,bladder2[ord,]))
Plac <- predict(ca, newdata = newdata, type = "survival")
Treat <- predict(ca, newdata = newdata, type = "survival")
PlacSA <- predict(ca, newdata = newdata,
type = "survival", aggregation = "simple", AggInd = c(10,20,30,40))
TreatSA <- predict(ca, newdata = newdata,
type = "survival", aggregation = "simple", AggInd = c(10,20,30,40))
PlacAA <- predict(ca, newdata = newdata,
type = "survival", aggregation = "adaptive", M=10)
TreatAA <- predict(ca, newdata = newdata,
type = "survival", aggregation = "adaptive", M=10)