SCM

SCM Repository

[latticeextra] View of /www/man/panel.quantile.html
ViewVC logotype

View of /www/man/panel.quantile.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 143 - (download) (as text) (annotate)
Tue May 25 06:54:57 2010 UTC (9 years ago) by felix
File size: 4738 byte(s)
get rid of ".featured_example", just use example number
<html><head><title>R: Plot a quantile regression line with standard error bounds.</title>


</head><body>

<table width="100%" summary="page for panel.quantile {latticeExtra}"><tr><td>panel.quantile {latticeExtra}</td><td align="right">R Documentation</td></tr></table>

<h2>Plot a quantile regression line with standard error bounds.</h2>


<h3>Description</h3>

<p>
Plot a quantile regression line with standard error bounds, using the
<span class="pkg">quantreg</span> package. This is based on the
<code><a href="../../ggplot2/html/stat_quantile.html">stat_quantile</a></code> function from <span class="pkg">ggplot2</span>.
</p>


<h3>Usage</h3>

<pre>
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)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>x, y</code></td>
<td>

data points. If these are missing, they will be looked for in the
environment of <code>form</code>. So in many cases you can skip these if
passing <code>form</code>. In fact, for convenience, the formula
can be passed as the first argument (i.e. <code>x</code>).
</td></tr>
<tr valign="top"><td><code>form, method</code></td>
<td>

the model is constructed (approximately) as
<code>method(form, tau = tau, data = list(x=x, y=y), ...)</code>.
See the Examples section for common choices.
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>

further arguments passed on to the model function (<code>method</code>),
typically <code><a href="../../quantreg/html/rq.html">rq</a></code>.
</td></tr>
<tr valign="top"><td><code>tau</code></td>
<td>

<VAR>p</VAR> values for the quantiles to estimate.
</p>
<p>
Note: only one value for <code>tau</code> can be specified if
estimating confidence intervals with <code>ci</code>.
</td></tr>
<tr valign="top"><td><code>ci, ci.type, level</code></td>
<td>

estimate a confidence interval at level <code>level</code> using the
method <code>ci.type</code>; see <code><a href="../../quantreg/html/predict.rq.html">predict.rq</a></code>.
</td></tr>
<tr valign="top"><td><code>n</code></td>
<td>

number of equi-spaced points on which to evaluate the function.
</td></tr>
<tr valign="top"><td><code>col, col.se, lty, lwd, alpha, alpha.se, border</code></td>
<td>

graphical parameters. <code>col</code> and <code>alpha</code> apply to the
line(s), while <code>col.se</code> and <code>alpha.se</code>
apply to the shaded <code>ci</code> region.
</td></tr>
<tr valign="top"><td><code>superpose</code></td>
<td>

if <code>TRUE</code>, plot each quantile line (<code>tau</code>) in a
different style (using <code>trellis.par.get("superpose.line")</code>).
</td></tr>
<tr valign="top"><td><code>subscripts, group.number, group.value,
type, col.line, col.symbol, fill,
pch, cex, font, fontface, fontfamily</code></td>
<td>

ignored.
</td></tr>
</table>


<h3>Details</h3>

<p>
It is recommended to look at <code>vignette("rq",package="quantreg")</code>.
</p>


<h3>Author(s)</h3>

<p>
Felix Andrews <a href="mailto:felix@nfrac.org">felix@nfrac.org</a>
</p>
<p>
Based on <code><a href="../../ggplot2/html/stat_quantile.html">stat_quantile</a></code> by Hadley Wickham.
</p>


<h3>See Also</h3>

<p>
<code><a href="../../quantreg/html/rq.html">rq</a></code>,
<code><a href="#panel.smoother">panel.smoother</a></code>,
<code><a href="../../ggplot2/html/stat_quantile.html">stat_quantile</a></code>
</p>


<h3>Examples</h3>

<pre>
library("quantreg")

set.seed(1)
xy &lt;- 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))

## seems not to work...
#xyplot(y ~ x, xy) +
#  layer(panel.quantile(y ~ qss(x, lambda=1), method = "rqss"))
</pre>

<div align="center">[Package <em>latticeExtra</em> version 0.6-12 <a href="00Index.html">Index</a>]</div>
</body></html>

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge