Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.summary.rqs

Visualizing sequences of quantile regression summaries


Description

A sequence of coefficient estimates for quantile regressions with varying tau parameters is visualized along with associated confidence bands.

Usage

## S3 method for class 'summary.rqs'
plot(x, parm = NULL, level = 0.9, ols = TRUE,
  mfrow = NULL, mar = NULL, ylim = NULL, main = NULL,
  col = gray(c(0, 0.75)), border = NULL, lcol = 2, lty = 1:2,
  cex = 0.5, pch = 20, type = "b", xlab = "", ylab = "", ...)

Arguments

x

an object of class "summary.rqs" as produce by applying the summary method to a rq object (with a vector of tau values).

parm

a specification of which parameters are to be plotted, either a vector of numbers or a vector of names. By default, all parameters are considered.

level

Confidence level of bands. When using the rank based confidence intervals in summary, which is the default method for sample sizes under 1000, you will need to control the level of the intervals by passing the parameter alpha to summary.rq, prior to calling plot.summary.rqs. Note also that alpha = 1 - level.

ols

logical. Should a line for the OLS coefficient and their confidence bands (as estimated by lm) be added?

mfrow, mar, ylim, main

graphical parameters. Suitable defaults are chosen based on the coefficients to be visualized. It can be useful to use a common vertical scale when plotting as a way of comparing confidence bands constructed by different methods. For this purpose one can specify a ylim as a 2 by length(parm) matrix.

col

vector of color specification for rq coefficients and the associated confidence polygon.

border

color specification for the confidence polygon. By default, the second element of col is used.

lcol, lty

color and line type specification for OLS coefficients and their confidence bounds.

cex, pch, type, xlab, ylab, ...

further graphical parameters passed to points.

Details

The plot method for "summary.rqs" objects visualizes the coefficients along with their confidence bands. The bands can be omitted by using the plot method for "rqs" objects directly.

Value

A list with components z, an array with all coefficients visualized (and associated confidence bands), and Ylim, a 2 by p matrix containing the y plotting limits. The latter component may be useful for establishing a common scale for two or more similar plots. The list is returned invisibly.

See Also

Examples

## fit Engel models (in levels) for tau = 0.1, ..., 0.9
data("engel")
fm <- rq(foodexp ~ income, data = engel, tau = 1:9/10)
sfm <- summary(fm)

## visualizations
plot(sfm)
plot(sfm, parm = 2, mar = c(5.1, 4.1, 2.1, 2.1), main = "", xlab = "tau", 
  ylab = "income coefficient", cex = 1, pch = 19)

quantreg

Quantile Regression

v5.85
GPL (>= 2)
Authors
Roger Koenker [cre, aut], Stephen Portnoy [ctb] (Contributions to Censored QR code), Pin Tian Ng [ctb] (Contributions to Sparse QR code), Blaise Melly [ctb] (Contributions to preprocessing code), Achim Zeileis [ctb] (Contributions to dynrq code essentially identical to his dynlm code), Philip Grosjean [ctb] (Contributions to nlrq code), Cleve Moler [ctb] (author of several linpack routines), Yousef Saad [ctb] (author of sparskit2), Victor Chernozhukov [ctb] (contributions to extreme value inference code), Ivan Fernandez-Val [ctb] (contributions to extreme value inference code), Brian D Ripley [trl, ctb] (Initial (2001) R port from S (to my everlasting shame -- how could I have been so slow to adopt R!) and for numerous other suggestions and useful advice)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.