Martingale Residuals
Estimates the martingale residuals of a generalized, linear model.
martingaleResid(dataSet, survModelFormula, censColumn, linkFunc = "logit", idColumn = NULL)
dataSet |
Original data in short format. Should be of class "data.frame". |
survModelFormula |
Formula of the discrete survival model. It is used in a generalized, linear model. |
censColumn |
Formula of the censoring model. It is used in a generalized, linear model. Usually this is done without covariates. |
linkFunc |
Link function of the generalized, linear model. |
idColumn |
Name of the column with identification numbers of persons. Default NULL means, that each row equals one person (no repeated measurements). |
Output: List with objects:
MartingaleResid: Square root of deviance residuals as numeric vector.
GlmFit: Fit object of class (generalized, linear model used in the calculations)
Input: A list of given argument input values (saved for reference)
Thomas Welchowski welchow@imbie.meb.uni-bonn.de
Gerhard Tutz and Matthias Schmid, (2016), Modeling discrete time-to-event data, Springer series in statistics, Doi: 10.1007/978-3-319-28158-2
Terry M. Therneau and Patricia M. Grambsch and Thomas R. Fleming, (1990), Martingale-Based Residuals for Survival Models, Biometrica, Vol. 77, No. 1, 147-160
# Example with cross validation and unemployment data library(Ecdat) data(UnempDur) summary(UnempDur$spell) # Extract subset of data set.seed(635) IDsample <- sample(1:dim(UnempDur)[1], 100) UnempDurSubset <- UnempDur [IDsample, ] # Calculate martingale residuals for the unemployment data subset MartResid <- martingaleResid (dataSet=UnempDurSubset, survModelFormula=spell ~ age + logwage, censColumn="censor1", linkFunc="logit", idColumn=NULL) MartResid sum(MartResid$Output$MartingaleResid) # Plot martingale residuals vs each covariate in the event interval # Dotted line is a loess estimate plot(MartResid)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.