QRdiagnostics: Quantile regression diagnostics based on the residuals, u_i.

View source: R/QREM.R

QRdiagnosticsR Documentation

Quantile regression diagnostics based on the residuals, u_i.

Description

For a given predictor, create a qq-plot if continuous, or a spinogram if categorical.

Usage

QRdiagnostics(X, varname, u_i, qn, plot.it = TRUE, filename = NULL)

Arguments

X

A predictor included in the regression.

varname

The predictor's name (for plotting).

u_i

The QR residuals.

qn

The quantile used in the regression.

plot.it

Boolean, if TRUE, will show the histogram of the residuals and the fitted kernel density estimate (default=TRUE).

filename

The pdf file to save the plot. Default is NULL (print to the screen.)

Value

A list, as follows, plus the marginal deviance:

  • For a continuous predictor, the list is called qqp and contains the output from qqplot().

  • For a categorical variable, the list is called qqlvl, and it contains the empirical percentages of points below the regression line, for each level.

Examples

data(simdf)
qremFit <-  QREM(lm,linmod=y~x*x2 +x3, df=simdf, qn=0.2)
qrdg <- QRdiagnostics(simdf$x, "x",qremFit$ui, 0.2,  plot.it = TRUE)
qrdg <- QRdiagnostics(simdf$x3, "x3",qremFit$ui, 0.2,  plot.it = TRUE)

haimbar/QREM documentation built on Aug. 27, 2022, 7:10 p.m.