residuals.regrpolr: Residuals of a Binary, Ordered, or Censored Regression

residuals.regrpolrR Documentation

Residuals of a Binary, Ordered, or Censored Regression

Description

Methods of residuals for classes polr, survreg and coxph, calculating quartiles and random numbers according to the conditional distribution of residuals for the latent variable of a binary or ordinal regression or a regression with censored response, given the observed response value. See Details for an explanation.

Usage

## S3 method for class 'polr'
residuals(object, type="condquant", ...)
## S3 method for class 'regrpolr'
residuals(object, type="condquant", ...)

## S3 method for class 'regrsurvreg'
residuals(object, type="condquant", ...)
## S3 method for class 'regrcoxph'
residuals(object, type="CoxSnellMod", ...)

Arguments

object

the result of polr, of glm(,family=binomial) with binary data for the regrpolr method, or of survreg or coxph for the respective methods.

type

type of residuals: "condquant" requires conditional quantiles (and more) of the residuals of the model, see Details.
For residuals.regrsurvreg, type CoxSnellMod yields a modified version of Cox-Snell residuals, also including a condquant attribute, see Details.
Other types are available according to the standard methods of the residuals function.

...

arguments passed to standard methods of residuals

Details

For binary and ordinal regression, the regression models can be described by introducing a latent response variable Z of which the observed response Y is a classified version, and for which a linear regression applies. The errors of this "latent regression" have a logistic distribution. Given the linearly predicted value eta[i], which is the fitted value for the latent variable, the residual for Z[i] can therefore be assumed to have a logistic distribution.

This function calculates quantiles and random numbers according to the conditional distribution of residuals for Z[i], given the observed y[i].

Modified Cox-Snell residuals: Cox-Snell residuals are defined in a way that they always follow an exponential distribution. Since this is an unususal law for residuals, it is convenient to transform them such that they then obey a standard normal distribution. See the vignette for more detail.

Value

Vector of residual values. If conditional quantiles are requested, the residuals for censored observations are replaced by conditional medians, and an attribute "condquant" is attached, which is a data.frame with the variables

median

median of the conditional distributions

lowq

lower quartile

uppq

upper quartile

random

random number, drawn according to the conditional distribution

prob

probability of the condition being true

limlow, limup

lower and upper limits of the intervals

index

index of the observation in the sequence of the result (residuals)

fit

linear predictor value

y

observed response value

Note

residuals.polr and residuals.regrpolr are identical for the time being. Only type="condquant" is available now.

Author(s)

Werner A. Stahel, ETH Zurich

References

See http://stat.ethz.ch/~stahel/regression

See Also

condquant, plregr

Examples

require(MASS)
data(housing, package="MASS")
rr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
t.res <- residuals.regrpolr(rr)
head   (t.res)
summary(t.res)

plgraphics documentation built on Oct. 19, 2023, 3 p.m.