SCM

SCM Repository

[latticeextra] Annotation of /pkg/man/panel.quantile.Rd
ViewVC logotype

Annotation of /pkg/man/panel.quantile.Rd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83 - (view) (download) (as text)

1 : felix 61 \name{panel.quantile}
2 :     \alias{panel.quantile}
3 :     \title{
4 :     Plot a quantile regression line with standard error bounds.
5 :     }
6 :     \description{
7 :     Plot a quantile regression line with standard error bounds, using the
8 :     \pkg{quantreg} package. This is based on the \code{\link[ggplot2]{stat_quantile}}
9 :     function from \pkg{ggplot2}.
10 :     }
11 :     \usage{
12 : felix 69 panel.quantile(x, y, form = y ~ x, method = "rq", ...,
13 : felix 61 tau = 0.5, ci = FALSE, ci.type = "default", level = 0.95,
14 :     n = 100, col = plot.line$col, col.se = col,
15 :     lty = plot.line$lty, lwd = plot.line$lwd,
16 :     alpha = plot.line$alpha, alpha.se = 0.25, border = NA,
17 :     superpose = FALSE,
18 :     ## ignored: ##
19 :     subscripts, group.number, group.value,
20 :     type, col.line, col.symbol, fill,
21 :     pch, cex, font, fontface, fontfamily)
22 :     }
23 :     \arguments{
24 :     \item{x, y}{
25 :     data points. If these are missing, they will be looked for in the
26 : felix 69 environment of \code{form}. So in many cases you can skip these if
27 :     passing \code{form}. In fact, for convenience, the formula
28 : felix 64 can be passed as the first argument (i.e. \code{x}).
29 : felix 61 }
30 : felix 69 \item{form, method}{
31 : felix 61 the model is constructed (approximately) as
32 : felix 69 \code{method(form, tau = tau, data = list(x=x, y=y), ...)}.
33 : felix 61
34 :     See the Examples section for common choices.
35 :     }
36 :     \item{\dots}{
37 :     further arguments passed on to the model function (\code{method}),
38 :     typically \code{\link[quantreg]{rq}}.
39 :     }
40 :     \item{tau}{
41 :     \var{p} values for the quantiles to estimate.
42 :    
43 :     Note: only one value for \code{tau} can be specified if
44 :     estimating confidence intervals with \code{ci}.
45 :     }
46 :     \item{ci, ci.type, level}{
47 :     estimate a confidence interval at level \code{level} using the
48 :     method \code{ci.type}; see \code{\link[quantreg]{predict.rq}}.
49 :     }
50 :     \item{n}{
51 :     number of equi-spaced points on which to evaluate the function.
52 :     }
53 :     \item{col, col.se, lty, lwd, alpha, alpha.se, border}{
54 :     graphical parameters. \code{col} and \code{alpha} apply to the
55 :     line(s), while \code{col.se} and \code{alpha.se}
56 :     apply to the shaded \code{ci} region.
57 :     }
58 :     \item{superpose}{
59 :     if \code{TRUE}, plot each quantile line (\code{tau}) in a
60 :     different style (using \code{trellis.par.get("superpose.line")}).
61 :     }
62 :     \item{subscripts, group.number, group.value,
63 :     type, col.line, col.symbol, fill,
64 :     pch, cex, font, fontface, fontfamily}{
65 :     ignored.
66 :     }
67 :     }
68 :     \details{
69 : felix 64 It is recommended to look at \code{vignette("rq",package="quantreg")}.
70 : felix 61 }
71 :     \author{
72 :     Felix Andrews \email{felix@nfrac.org}
73 : felix 64
74 :     Based on \code{\link[ggplot2]{stat_quantile}} by Hadley Wickham.
75 : felix 61 }
76 :     \seealso{
77 :     \code{\link[quantreg]{rq}},
78 :     \code{\link{panel.smoother}},
79 :     \code{\link[ggplot2]{stat_quantile}}
80 :     }
81 :     \examples{
82 : felix 69 library("quantreg")
83 :    
84 :     set.seed(1)
85 : felix 61 xy <- data.frame(x = runif(100), y = rt(100, df = 5))
86 :     xyplot(y ~ x, xy) +
87 : felix 73 layer(panel.quantile(x, y, tau = c(.95, .5, .05)))
88 : felix 61
89 : felix 64 if (require("splines")) {
90 :     xyplot(y ~ x, xy) +
91 :     layer(panel.quantile(y ~ ns(x, 3), tau = 0.9))
92 : felix 61
93 : felix 64 xyplot(y ~ x, xy) +
94 :     layer(panel.quantile(y ~ ns(x, 3), tau = 0.9, ci = TRUE))
95 :     }
96 : felix 61
97 :     xyplot(y ~ x, xy) +
98 : felix 81 layer(panel.quantile(x, y, tau = c(.5, .9, .1), superpose = TRUE))
99 : felix 61
100 :     update(trellis.last.object(),
101 : felix 83 auto.key = list(text = paste(c(50,90,10), "\% quantile"),
102 : felix 61 points = FALSE, lines = TRUE))
103 :    
104 :     ## seems not to work...
105 :     #xyplot(y ~ x, xy) +
106 : felix 64 # layer(panel.quantile(y ~ qss(x, lambda=1), method = "rqss"))
107 : felix 61 }
108 :     \keyword{ dplot }

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge