predict.fmm {frailtyMMpen} | R Documentation |
Estimate the baseline hazard or the predict hazard rate based on the new data for non-penalized regression
Description
This function is used to estimate the baseline hazard or to predict the hazard rate of a specific individual given result from model fitting.
Usage
##S3 method for class "fmm"
Arguments
object |
Object with class "fmm" |
newdata |
The new data for prediction of hazard, categorical data has to be transformed to 0 and 1 |
surv |
Plot survival curve instead of cumulative hazard, the default is |
... |
Further arguments pass to or from other methods |
Details
If parameter newdata
is given, the predicted hazard is calculated based on the given data.
If parameter newdata
is not given, the estimation of baseline hazard will be returned.
The confidence band is calculated based on the delta method. Please insure that the input of new data
should be of the same coefficient name as object$coefname
. Note that if original data contains categorical data, you could check
object$coefname
to input the corresponding 0 or 1 and name of coefficient for the newdata
.
For example, if the coefficient name is "sexfemale", then 1 denotes female while 0 denotes male. You may refer to the
example below to construct the new data.
Value
output |
A dataframe that the first column is the evaluated time point, the second column is the estimated cumulative hazard or survival curve, the third column is the standard error of the estimation result and the fourth and fifth column are the lower bound and upper bound based on 95 percent confidence interval. |
Examples
gam_re = frailtyMM(Surv(tstart, tstop, status) ~ sex + treat + cluster(id), cgd, frailty = "Gamma")
# Calculate the survival curve based on baseline hazard
predict(gam_re, surv = TRUE)
# Construct new data and calculate the cumulative hazard based on new data
newre = c(1, 1, 2)
names(newre) = c(gam_re$coefname, "id")
predict(gam_re, newdata = newre)