Learn R Programming

quantreg (version 5.99.1)

plot.rqss: Plot Method for rqss Objects

Description

Takes a fitted rqss object produced by rqss() and plots the component smooth functions that make up the ANOVA decomposition. Since the components "omit the intercept" the estimated intercept is added back in -- this facilitates the comparison of quantile fits particularly. For models with a partial linear component or several qss components it may be preferable to plot the output of predict.rqss. Note that these functions are intended to plot rqss objects only, attempting to plot summary.rqss objects just generates a warning message.

Usage

# S3 method for rqss
plot(x, rug = TRUE, jit = TRUE, bands = NULL, coverage = 0.95,
	add = FALSE, shade = TRUE, select = NULL, pages = 0, titles = NULL, 
	bcol = NULL, ...)
# S3 method for qss1
plot(x, rug = TRUE, jit = TRUE, add = FALSE, ...)
# S3 method for qts1
plot(x, rug = TRUE, jit = TRUE, add = FALSE, ...)
# S3 method for qss2
plot(x, render = "contour", ncol = 100, zcol = NULL, ...)
# S3 method for summary.rqss
plot(x, ...)

Value

The function produces plots for the ANOVA components as a side effect. For "qss1" the "add = TRUE" can be used to overplot the fit on a scatterplot. When there are multiple pages required "par(ask = TRUE)"

is turned on so that the plots may be examined sequentially. If bands != NULL

then a list with three components for each qss component is returned (invisibly):

x

The x coordinates of the confidence bands

blo

The y coordinates of the lower confidence curve, if bands = "both" then this is a matrix with two columns

bhi

The y coordinates of the upper confidence curve, if bands = "both" then this is a matrix with two columns

Arguments

x

a fitted rqss object produced by rqss().

...

additional arguments for the plotting algorithm

rug

if TRUE, a rugplot for the x-coordinate is plotted

jit

if TRUE, the x-values of the rug plot are jittered

bands

if TRUE, confidence bands for the smoothed effects are plotted, if "uniform" then uniform bands are plotted, if "both" then both the uniform and the pointwise bands are plotted.

coverage

desired coverage probability of confidence bands, if requested

select

vector of indices of qss objects to be plotted, by default all

pages

number of pages desired for the plots

render

a character specifying the rendering for bivariate fits; either "contour" (default) or "rgl". The latter requires package rgl.

add

if TRUE then add qss curve to existing (usually) scatterplot, otherwise initiate a new plot

shade

if TRUE then shade the confidence band

titles

title(s) as vector of character strings, by default titles are chosen for each plot as "Effect of CovariateName"

bcol

vector of two colors for confidence bands

ncol, zcol

Only for render = "rgl": number of colors and z values for color construction.

Author

Roger Koenker

Details

For univariate qss components with Dorder = 0 the fitted function is piecewise constant, not piecewise linear. In this case the constraints are limited to increasing, decreasing or none. If bands == "uniform" then the bands are uniform bands based on the Hotelling (1939) tube approach. See also Naiman (1986), Johansen and Johnstone (1990), Sun and Loader (1994), and Krivobokova, Kneib, and Claeskens (2009), in particular the computation of the "tube length" is based on the last of these references. If bands is non null, and not "uniform" then pointwise bands are returned. Since bands for bivariate components are not (yet) supported, if requested such components will be returned as NULL.

References

[1] Hotelling, H. (1939): ``Tubes and Spheres in $n$-spaces, and a class of statistical problems,'' Am J. Math, 61, 440--460.

[2] Johansen, S., and I.M. Johnstone (1990): ``Hotelling's Theorem on the Volume of Tubes: Some Illustrations in Simultaneous Inference and Data Analysis,'' The Annals of Statistics, 18, 652--684.

[3] Naiman, D. (1986) Conservative confidence bands in curvilinear regression, The Annals of Statistics, 14, 896--906.

[4] Sun, J. and C.R. Loader, (1994) Simultaneous confidence bands for linear regression and smoothing, The Annals of Statistics, 22, 1328--1345.

[5] Krivobokova, T., T. Kneib, and G. Claeskens (2009) Simultaneous Confidence Bands for Penalized Spline Estimators, preprint.

[6] Koenker, R. (2010) Additive Models for Quantile Regression: Model Selection and Confidence Bandaids, preprint.

See Also

rqss

Examples

Run this code
n <- 200
x <- sort(rchisq(n,4))
z <- x + rnorm(n)
y <- log(x)+ .1*(log(x))^2 + log(x)*rnorm(n)/4 + z
plot(x,y-z)
fN <- rqss(y~qss(x,constraint="N")+z)
plot(fN)
fI <- rqss(y~qss(x,constraint="I")+z)
plot(fI,  col="blue")
fCI <- rqss(y~qss(x,constraint="CI")+z)
plot(fCI, col="red")


## A bivariate example
if(requireNamespace("interp")){
if(requireNamespace("interp")){
data(CobarOre)
fCO <- rqss(z~qss(cbind(x,y),lambda=.08), data = CobarOre)
plot(fCO)
}}

Run the code above in your browser using DataLab