Predict overall survival probability at certain time points from fitted Cox models.

# S3 method for hdnom.model
predict(object, x, y, newx, pred.at, ...)

Arguments

object

Model object.

x

Data matrix used to fit the model.

y

Response matrix made with Surv.

newx

Matrix (with named columns) of new values for x at which predictions are to be made.

pred.at

Time point at which prediction should take place.

...

Other parameters (not used).

Value

A nrow(newx) x length(pred.at) matrix containing overall survival probablity.

Examples

data("smart") x <- as.matrix(smart[, -c(1, 2)]) time <- smart$TEVENT event <- smart$EVENT y <- survival::Surv(time, event) fit <- fit_lasso(x, y, nfolds = 5, rule = "lambda.1se", seed = 11) predict(fit, x, y, newx = x[101:105, ], pred.at = 1:10 * 365)
#> 365 730 1095 1460 1825 2190 2555 #> [1,] 0.9426815 0.9126720 0.8774868 0.8431967 0.7994927 0.7640509 0.7198655 #> [2,] 0.9617984 0.9414832 0.9173726 0.8935568 0.8627192 0.8372884 0.8050140 #> [3,] 0.9752150 0.9618922 0.9459469 0.9300495 0.9092393 0.8918778 0.8695718 #> [4,] 0.9208795 0.8802028 0.8331825 0.7880717 0.7316247 0.6867360 0.6319216 #> [5,] 0.9688175 0.9521411 0.9322616 0.9125292 0.8868323 0.8655117 0.8382784 #> 2920 3285 3650 #> [1,] 0.6780845 0.6212863 0.6212863 #> [2,] 0.7738700 0.7304625 0.7304625 #> [3,] 0.8477434 0.8167907 0.8167907 #> [4,] 0.5813016 0.5144566 0.5144566 #> [5,] 0.8118050 0.7745720 0.7745720