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

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/predict.parfm.R

Description

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

Usage

1
2
## 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 10.18637/jss.v051.i11

See Also

parfm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)

Example output

Loading required package: survival
Loading required package: optimx
Gamma frailty model with Exponential baseline
 id frailty
 1  1.325  
 2  1.207  
 3  1.109  
 4  0.632  
 5  1.199  
 6  1.065  
 7  1.386  
 8  0.723  
 9  1.002  
 10 0.604  
 11 0.929  
 12 0.999  
 13 1.258  
 14 0.684  
 15 0.634  
 16 1.072  
 17 0.874  
 18 0.86   
 19 0.713  
 20 1.031  
 21 0.205  
 22 0.704  
 23 1.353  
 24 1.103  
 25 1.077  
 26 0.759  
 27 1.053  
 28 1.403  
 29 1.266  
 30 1.188  
 31 1.344  
 32 1.176  
 33 1.134  
 34 0.919  
 35 1.288  
 36 0.871  
 37 1.097  
 38 0.756  
Warning message:
In coxpenal.fit(X, Y, strats, offset, init = init, control, weights = weights,  :
  Inner loop failed to coverge for iterations 3

parfm documentation built on May 31, 2017, 2:48 a.m.