predict.grpsurv | R Documentation |
Similar to other predict methods, this function returns predictions from a fitted grpsurv
object.
## S3 method for class 'grpsurv'
predict(
object,
X,
type = c("link", "response", "survival", "hazard", "median", "norm", "coefficients",
"vars", "nvars", "groups", "ngroups"),
lambda,
which = 1:length(object$lambda),
...
)
object |
Fitted |
X |
Matrix of values at which predictions are to be made. Not required for some |
type |
Type of prediction:
|
lambda |
Regularization parameter at which predictions are requested. For values of |
which |
Indices of the penalty parameter |
... |
Not used. |
Estimation of baseline survival function conditional on the estimated values of beta
is carried out according to the method described in Chapter 4.3 of Kalbfleisch and Prentice.
The object returned depends on type.
Patrick Breheny
Kalbfleish JD and Prentice RL (2002). The Statistical Analysis of Failure Time Data, 2nd edition. Wiley.
grpsurv()
data(Lung)
X <- Lung$X
y <- Lung$y
group <- Lung$group
fit <- grpsurv(X, y, group)
coef(fit, lambda=0.05)
head(predict(fit, X, type="link", lambda=0.05))
head(predict(fit, X, type="response", lambda=0.05))
# Survival function
S <- predict(fit, X[1,], type="survival", lambda=0.05)
S(100)
S <- predict(fit, X, type="survival", lambda=0.05)
plot(S, xlim=c(0,200))
# Medians
predict(fit, X[1,], type="median", lambda=0.05)
M <- predict(fit, X, type="median")
M[1:10, 1:10]
# Nonzero coefficients
predict(fit, type="vars", lambda=c(0.1, 0.01))
predict(fit, type="nvars", lambda=c(0.1, 0.01))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.