Learn R Programming

discSurv (version 1.1.2)

martingaleResid: Martingale Residuals

Description

Estimates the martingale residuals of a generalized, linear model.

Usage

martingaleResid(dataSet, survModelFormula, censColumn, 
linkFunc = "logit", idColumn = NULL)

Arguments

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

Value

    • 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)}

item

Input:

References

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

See Also

tprUno, tprUnoShort, aucUno, concorIndex, glm

Examples

Run this code
# 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)

Run the code above in your browser using DataLab