Learn R Programming

discSurv (version 1.1.2)

devResid: Deviance Residuals

Description

Computes the root of the deviance residuals for evaluation of performance in discrete survival analysis. A generalized, linear model is used for prediction.

Usage

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

Arguments

dataSet
Original data in short format. Must be of class "data.frame".
survModelFormula
Gives the specified relationship of discrete response and covariates. The formula is designed, that the intercepts for the time dependent base line hazards are always included. Therefore only covariates should be given in this formula. This argument is re
censColumn
Gives the column name of the event indicator (1=observed, 0=censored). Must be of type "character".
linkFunc
Specifies the desired link function in use of generalized, linear models.
idColumn
Gives the column name of the identification number of each person. The argument must be of type "character". Default NULL means, that each row equals one person (no repeated measurements).

Value

    • Output:
    {List with objects:}
    • DevResid:
    {Square root of deviance residuals as numeric vector.}
  • GlmFit:
  • {Fit object of class (generalized, linear model used in the calculations)}

item

Input:

References

Gerhard Tutz, (2012), Regression for Categorical Data, Cambridge University Press

See Also

adjDevResid, brierScore, glm, predErrDiscShort

Examples

Run this code
library(Ecdat)
# Example with cross validation and unemployment data 
data(UnempDur)
summary(UnempDur$spell)

# Extract subset of data
set.seed(635)
IDsample <- sample(1:dim(UnempDur)[1], 100)
UnempDurSubset <- UnempDur [IDsample, ]

# Calculate deviance residuals for the unemployment data subset
devianceResiduals <- devResid (dataSet=UnempDurSubset, survModelFormula=spell ~ age + logwage, 
censColumn="censor1", linkFunc="logit", idColumn=NULL)
devianceResiduals

Run the code above in your browser using DataLab