predict.parfm: Predictions of frailty values for Parametric Frailty Models

View source: R/predict.parfm.R

predict.parfmR Documentation

Predictions of frailty values for Parametric Frailty Models

Description

The function predict.parfm() computes predictions of frailty values for objects of class parfm.

Usage

## S3 method for class 'parfm'
predict(object, ...)

Arguments

object

A parametric frailty model, object of class parfm.

...

see predict()

Value

An object of class predict.parfm.

Author(s)

Federico Rotolo [aut, cre], Marco Munda [aut], Andrea Callegaro [ctb]

References

Glidden D, Vittinghoff E (2004). Modelling Clustered Survival Data From Multicentre Clinical Trials. Statistics in medicine, 23(3), 369–388.

Munda M, Rotolo F, Legrand C (2012). parfm: Parametric Frailty Models in R. Journal of Statistical Software, 51(11), 1-20. DOI <doi: 10.18637/jss.v051.i11>

See Also

parfm

Examples

data(kidney)
kidney$sex <- kidney$sex - 1

model <- parfm(Surv(time,status) ~ sex + age, 
               cluster = "id", data = kidney,
               dist = "exponential", frailty = "gamma")
u <- predict(model)
u


# Predictions from semi-parametric Gamma frailty model
# via coxph() function
model.coxph <- coxph(Surv(time,status) ~ sex + age + 
                         frailty(id, frailty = "gamma", eps = 1e-11), 
                     outer.max = 15, data = kidney)
u.coxph <- exp(model.coxph$frail)


# Plot of predictions from both models
par(mfrow = c(1,2))
ylim <- c(0, max(c(u, u.coxph)))
plot(u, sort = "i",
     main = paste("Parametric", 
                  "Gamma frailty model",
                  "with Exponential baseline", 
                  sep = "\n"),
     ylim = ylim)

names(u.coxph) <- kidney[seq(2,76, 2), "id"]
class(u.coxph) <- "predict.parfm"
attr(u.coxph, "clustname") <- "id"
plot(u.coxph, sort = "i",
     main = paste("Semi-parametric",
                  "Gamma frailty model", sep = "\n"),
     ylim = ylim)

parfm documentation built on Jan. 18, 2023, 1:08 a.m.