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

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

`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. |

returns an object of type "cum.residuals" with the following arguments:

`cum` |
cumulative residuals versus time for the groups specified by modelmatrix. |

`var.cum` |
the martingale based pointwise variance estimates. |

`robvar.cum` |
robust pointwise variances estimates of cumulatives. |

`obs.testBeq0` |
observed absolute value of supremum of cumulative components scaled with the variance. |

`pval.testBeq0` |
p-value covariate effects based on supremum test. |

`sim.testBeq0` |
resampled supremum value. |

`conf.band` |
resampling based constant to construct robust 95% uniform confidence bands for cumulative residuals. |

`obs.test` |
absolute value of supremum of observed test-process. |

`pval.test` |
p-value for supremum test statistic. |

`sim.test` |
resampled absolute value of supremum cumulative residuals. |

`proc.cumz` |
observed cumulative residuals versus all continuous covariates of model. |

`sim.test.proccumz` |
list of 50 random realizations of test-processes under model for all continuous covariates. |

Thomas Scheike

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.