surv.resid: Cox-Snell residuals

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

View source: R/AFTresiduals.R

Description

Cox-Snell residuals of the survreg.aft fit.

Usage

1
2
surv.resid(fit, plot = FALSE, xlim = NULL, ylim = NULL,
  main = NULL)

Arguments

fit

survreg.aft fit.

plot

returns residual plot if TRUE (default is FALSE).

xlim

x limits (x1, x2) of the plot (optional).

ylim

y limits of the plot (optional).

main

main title of the plot (optional).

Details

Plot of the Cox-Snell (hazard-based) residuals should be roughly a straight line with unit slope when the model is adequate. See Section 6.2 of Lawless and Section 3.7.3 of Cook and Lawless for details.

Value

residuals Cox-Snell residuals.

plot residual plot if plot=TRUE.

Author(s)

Shahedul Khan <khan@math.usask.ca>

References

Cook RJ and Lawless J, The statistical analysis of recurrent events, Springer, 2007.

Lawless J, Statistical models and methods for lifetime data, Wiley, 2003.

See Also

survreg.aft, LR.test.

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
# Example 1: Recurrent Event Analysis
  library(frailtypack)
  data(readmission)
# Recoding sex and chemo
  sex<-factor(2-as.numeric(readmission$sex),
       labels=c("Female","Male"))
  chemo<-factor(as.numeric(readmission$chemo)-1,
         labels=c("NonTreated","Treated"))
  Data<-readmission
  Data$sex<-sex
  Data$chemo<-chemo
  fit.gg<-survreg.aft(c(t.start,t.stop,event)~sex+chemo+charlson,
      Data=Data,model="ggamma")
  fit.w<-survreg.aft(c(t.start,t.stop,event)~sex+chemo+charlson,
      Data=Data,model="weibull")
  surv.resid(fit.w)
  par(mfrow=c(1,2))
  surv.resid(fit.w,plot=TRUE,xlim=c(0,4.75),ylim=c(0,4.75),main="Weibull")
  surv.resid(fit.gg,plot=TRUE,xlim=c(0,4.75),ylim=c(0,4.75),main="Generalized Gamma")

# Example 2: Non-recurrent Data (Right Censored)
  library(survival)
  fit.ll<-survreg.aft(c(time,status)~karno+diagtime+age+prior+celltype+trt,
      Data=veteran,model="llogistic")
  surv.resid(fit.ll,plot=TRUE,main="Log-logistic")

sa4khan/AFTjmr documentation built on March 12, 2020, 1:24 a.m.