Learn R Programming

L1pack (version 0.62-4)

residuals.lad: Residuals for LAD regression

Description

Computes raw or randomized quantile residual for least absolute regression.

Usage

# S3 method for lad
residuals(object, type = c("working", "response", "quantile"), ...)

Value

Residuals extracted from the lad object.

Arguments

object

a fitted model object.

type

a character string indicating the type of residual. Available options are "working", "response" for raw residuals, and "quantile" for quantile residuals, the latter being standardized residuals.

...

additional argument(s) for related methods.

References

Dunn, P.K., Smyth, G.K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics 5, 236-244. tools:::Rd_expr_doi("10.1080/10618600.1996.10474708")

Examples

Run this code
data(ereturns)
fm <- lad(m.marietta ~ CRSP, data = ereturns)
r <- residuals(fm, type = "quantile")
obs <- c(8,15,34)
plot(r, ylim = c(-2,6), ylab = "quantile residual")
abline(h = 0, lwd = 2, col = "gray75")
abline(h = c(-2,2), lwd = 2, lty = 2, col = "red")
text(obs, r[obs], as.character(obs), pos = 3)

Run the code above in your browser using DataLab