MartingalePlot.RdProduces a plot of the martingale or deviance residuals, smoothed with lowess and a confidence band based on visreg asymptotics. Additionally, a bootstrap confidence band can be obtained.
MartingalePlot(DFR, TIMES, STATUS, METRIC, COLUMNS = NULL, TYPE = "martingale", SPANLOESS = 2/3, NBOOT = 0, XLIM = NULL, YLIM = NULL, XLAB = NULL, YLAB = "Martingale residuals", MAIN = NULL, SUB = NULL, PCH = 1, PCEX = 1)
| DFR | data.frame containing the time to event and metric variable |
|---|---|
| TIMES | name of variable in DFR: EITHER Time to event variable of class "Surv" OR time component of time to event |
| STATUS | name of variable in DFR: status component von time to event (needed only if TIMES is not of class "Surv") |
| METRIC | name of metric variable in DFR to be investigated |
| COLUMNS | = NULL, vector of further covariate names in DFR != METRIC to adjust for in calculating the residuals. |
| TYPE | ="martingale", specifies type of residuum, "martingale" or the more symmetric "deviance" |
| SPANLOESS | =2/3, smoothing parameter for lowess smoother |
| NBOOT | =0, number of Bootstrap simulations. Set to > 0 (e.g. 1000), if additional bootstrap confidence band desired |
| XLIM | =NULL, set range on x-axis manually instead of automatically |
| YLIM | =NULL, set range on y-axis manually instead of automatically |
| XLAB | =NULL, set x-axis label manually instead of automatically |
| YLAB | ="Martingale residuals", standard y-axis label |
| MAIN | =NULL, for no main title set MAIN="" |
| SUB | =NULL, subtitle below XLAB, if unspecified adjusted for: COLUMNS |
| PCH | =1 pointtype for martingalresidues |
| PCEX | =1 pont size (cex) |
produces a plot
MartingalePlot
if (FALSE) { require(MASS) data(VA) # The Martingal plot shows the functional form of the dependence of # a time to event and a metric variable. MartingalePlot(VA,"stime","status","age") MartingalePlot(VA,"stime","status","age",SPANLOESS = .9) MartingalePlot(VA,"stime","status","age", XLIM=c(40,70)) MartingalePlot(VA,"stime","status","Karn") MartingalePlot(VA,"stime","status","Karn",SPANLOESS = .9) # Martingal residues of age after adjusting linearly for karno MartingalePlot(VA,"stime","status","age",COLUMNS ="Karn", SPANLOESS = .9, XLIM=c(40,70)) }