Learn R Programming

timereg (version 1.8.6)

cum.residuals: Model validation based on cumulative residuals

Description

Computes cumulative residuals and approximative p-values based on resampling techniques.

Usage

cum.residuals(object,data=sys.parent(),modelmatrix=0,cum.resid=1,
              n.sim=500,weighted.test=0,max.point.func=50,weights=NULL)

Arguments

object
an object of class 'aalen', 'timecox', 'cox.aalen' where the residuals are returned ('residuals=1')
data
data frame based on which residuals are computed.
modelmatrix
specifies a grouping of the data that is used for cumulating residuals. Must have same size as data and be ordered in the same way.
n.sim
number of simulations in resampling.
weighted.test
to compute a variance weighted version of the test-processes used for testing constant effects of covariates.
cum.resid
to compute residuals versus each of the continuous covariates in the model.
max.point.func
limits the amount of computations, only considers a max of 50 points on the covariate scales.
weights
weights for sum of martingale residuals, now for cum.resid=1.

Value

  • returns an object of type "cum.residuals" with the following arguments:
  • cumcumulative residuals versus time for the groups specified by modelmatrix.
  • var.cumthe martingale based pointwise variance estimates.
  • robvar.cumrobust pointwise variances estimates of cumulatives.
  • obs.testBeq0observed absolute value of supremum of cumulative components scaled with the variance.
  • pval.testBeq0p-value covariate effects based on supremum test.
  • sim.testBeq0resampled supremum value.
  • conf.bandresampling based constant to construct robust 95% uniform confidence bands for cumulative residuals.
  • obs.testabsolute value of supremum of observed test-process.
  • pval.testp-value for supremum test statistic.
  • sim.testresampled absolute value of supremum cumulative residuals.
  • proc.cumzobserved cumulative residuals versus all continuous covariates of model.
  • sim.test.proccumzlist of 50 random realizations of test-processes under model for all continuous covariates.

References

Martinussen and Scheike, Dynamic Regression Models for Survival Data, Springer (2006).

Examples

Run this code
data(sTRACE)
# Fits Aalen model and returns residuals
fit<-aalen(Surv(time,status==9)~age+sex+diabetes+chf+vf,
           data=sTRACE,max.time=7,n.sim=0,residuals=1)

# constructs and simulates cumulative residuals versus age groups
fit.mg<-cum.residuals(fit,data=sTRACE,n.sim=100,
modelmatrix=model.matrix(~-1+factor(cut(age,4)),sTRACE))

par(mfrow=c(1,4))
# cumulative residuals with confidence intervals
plot(fit.mg);
# cumulative residuals versus processes under model
plot(fit.mg,score=1); 
summary(fit.mg)

# cumulative residuals vs. covariates Lin, Wei, Ying style 
fit.mg<-cum.residuals(fit,data=sTRACE,cum.resid=1,n.sim=100)

par(mfrow=c(2,4))
plot(fit.mg,score=2)
summary(fit.mg)

Run the code above in your browser using DataLab