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.
# 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 qss2
plot(x, render = "contour", ncol = 100, zcol = NULL, …)
# S3 method for summary.rqss
plot(x, …)
a fitted rqss
object produced by rqss()
.
additional arguments for the plotting algorithm
if TRUE, a rugplot for the x-coordinate is plotted
if TRUE, the x-values of the rug plot are jittered
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.
desired coverage probability of confidence bands, if requested
vector of indices of qss objects to be plotted, by default all
number of pages desired for the plots
a character specifying the rendering for bivariate fits;
either "contour"
(default) or "rgl"
. The latter
requires package rgl.
if TRUE then add qss curve to existing (usually) scatterplot, otherwise initiate a new plot
if TRUE then shade the confidence band
title(s) as vector of character strings, by default titles are chosen for each plot as "Effect of CovariateName"
vector of two colors for confidence bands
Only for render = "rgl"
: number of colors and
z values for color construction.
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):
The x coordinates of the confidence bands
The y coordinates of the lower confidence curve, if
bands = "both"
then this is a matrix with two columns
The y coordinates of the upper confidence curve, if
bands = "both"
then this is a matrix with two columns
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
.
[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.
# NOT RUN {
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")
# }
# NOT RUN {
<!-- %%keep objects for inspection : do not rm(n,x,y,z,fit) -->
# }
# NOT RUN {
## A bivariate example
data(CobarOre)
fCO <- rqss(z~qss(cbind(x,y),lambda=.08), data = CobarOre)
plot(fCO)
# }
Run the code above in your browser using DataLab