Description Usage Arguments Details Author(s) See Also Examples
View source: R/panel.quantile.R
Plot a quantile regression line with standard error bounds, using the
quantreg package. This is based on the
stat_quantile
function from ggplot2.
1 2 3 4 5 6 7 8 9 10 | panel.quantile(x, y, form = y ~ x, method = "rq", ...,
tau = 0.5, ci = FALSE, ci.type = "default", level = 0.95,
n = 100, col = plot.line$col, col.se = col,
lty = plot.line$lty, lwd = plot.line$lwd,
alpha = plot.line$alpha, alpha.se = 0.25, border = NA,
superpose = FALSE,
## ignored: ##
subscripts, group.number, group.value,
type, col.line, col.symbol, fill,
pch, cex, font, fontface, fontfamily)
|
x, y |
data points. If these are missing, they will be looked for in the
environment of |
form, method |
Formula and the name of a modeling function (as a character
string). The model is constructed (approximately) as
|
... |
further arguments passed on to the model function ( |
tau |
p values for the quantiles to estimate. Note: only one value for |
ci, ci.type, level |
estimate a confidence interval at level |
n |
number of equi-spaced points on which to evaluate the function. |
col, col.se, lty, lwd, alpha, alpha.se, border |
graphical parameters. |
superpose |
if |
subscripts, group.number, group.value,
type, col.line, col.symbol, fill,
pch, cex, font, fontface, fontfamily |
ignored. |
It is recommended to look at vignette("rq", package="quantreg")
.
Felix Andrews felix@nfrac.org
Based on stat_quantile
by Hadley Wickham.
rq
,
panel.smoother
,
stat_quantile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## library("quantreg")
set.seed(1)
xy <- data.frame(x = runif(100), y = rt(100, df = 5))
xyplot(y ~ x, xy) +
layer(panel.quantile(x, y, tau = c(.95, .5, .05)))
if (require("splines")) {
xyplot(y ~ x, xy) +
layer(panel.quantile(y ~ ns(x, 3), tau = 0.9))
xyplot(y ~ x, xy) +
layer(panel.quantile(y ~ ns(x, 3), tau = 0.9, ci = TRUE))
}
xyplot(y ~ x, xy) +
layer(panel.quantile(x, y, tau = c(.5, .9, .1), superpose = TRUE))
update(trellis.last.object(),
auto.key = list(text = paste(c(50,90,10), "% quantile"),
points = FALSE, lines = TRUE))
xyplot(y ~ x, xy) +
layer(panel.quantile(y ~ qss(x, lambda=1), method = "rqss"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.