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.
# S3 method for polr
residuals(object, type="condquant", ...)
# S3 method for regrpolr
residuals(object, type="condquant", ...)
# S3 method for regrsurvreg
residuals(object, type="condquant", ...)
# S3 method for regrcoxph
residuals(object, type="CoxSnellMod", ...)
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 of the conditional distributions
lower quartile
upper quartile
random number, drawn according to the conditional distribution
probability of the condition being true
lower and upper limits of the intervals
index of the observation in the sequence of the result (residuals)
linear predictor value
observed response value
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 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 type
s are available according to the standard
methods of the residuals
function.
arguments passed to standard methods of residuals
Werner A. Stahel, ETH Zurich
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.
See http://stat.ethz.ch/~stahel/regression
condquant
, plregr
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)
Run the code above in your browser using DataLab