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 137 - (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 : deepayan 137 \pkg{quantreg} package. This is based on the
9 :     \code{\link[ggplot2]{stat_quantile}} function from \pkg{ggplot2}.
10 : felix 61 }
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 See the Examples section for common choices.
34 :     }
35 :     \item{\dots}{
36 :     further arguments passed on to the model function (\code{method}),
37 : deepayan 137 typically \code{\link[quantreg]{rq}}.
38 : felix 61 }
39 :     \item{tau}{
40 :     \var{p} values for the quantiles to estimate.
41 :    
42 :     Note: only one value for \code{tau} can be specified if
43 :     estimating confidence intervals with \code{ci}.
44 :     }
45 :     \item{ci, ci.type, level}{
46 :     estimate a confidence interval at level \code{level} using the
47 : deepayan 137 method \code{ci.type}; see \code{\link[quantreg]{predict.rq}}.
48 : felix 61 }
49 :     \item{n}{
50 :     number of equi-spaced points on which to evaluate the function.
51 :     }
52 :     \item{col, col.se, lty, lwd, alpha, alpha.se, border}{
53 :     graphical parameters. \code{col} and \code{alpha} apply to the
54 :     line(s), while \code{col.se} and \code{alpha.se}
55 :     apply to the shaded \code{ci} region.
56 :     }
57 :     \item{superpose}{
58 :     if \code{TRUE}, plot each quantile line (\code{tau}) in a
59 :     different style (using \code{trellis.par.get("superpose.line")}).
60 :     }
61 :     \item{subscripts, group.number, group.value,
62 :     type, col.line, col.symbol, fill,
63 :     pch, cex, font, fontface, fontfamily}{
64 :     ignored.
65 :     }
66 :     }
67 :     \details{
68 : felix 64 It is recommended to look at \code{vignette("rq",package="quantreg")}.
69 : felix 61 }
70 :     \author{
71 :     Felix Andrews \email{felix@nfrac.org}
72 : felix 64
73 : deepayan 137 Based on \code{\link[ggplot2]{stat_quantile}} by Hadley Wickham.
74 : felix 61 }
75 :     \seealso{
76 : deepayan 137 \code{\link[quantreg]{rq}},
77 : felix 61 \code{\link{panel.smoother}},
78 : deepayan 137 \code{\link[ggplot2]{stat_quantile}}
79 : felix 61 }
80 :     \examples{
81 : felix 69 library("quantreg")
82 :    
83 :     set.seed(1)
84 : felix 61 xy <- data.frame(x = runif(100), y = rt(100, df = 5))
85 :     xyplot(y ~ x, xy) +
86 : felix 73 layer(panel.quantile(x, y, tau = c(.95, .5, .05)))
87 : felix 61
88 : felix 64 if (require("splines")) {
89 :     xyplot(y ~ x, xy) +
90 :     layer(panel.quantile(y ~ ns(x, 3), tau = 0.9))
91 : felix 61
92 : felix 64 xyplot(y ~ x, xy) +
93 :     layer(panel.quantile(y ~ ns(x, 3), tau = 0.9, ci = TRUE))
94 :     }
95 : felix 61
96 :     xyplot(y ~ x, xy) +
97 : felix 81 layer(panel.quantile(x, y, tau = c(.5, .9, .1), superpose = TRUE))
98 : felix 120 \dontshow{ .featured_example <- TRUE }
99 : felix 61 update(trellis.last.object(),
100 : felix 83 auto.key = list(text = paste(c(50,90,10), "\% quantile"),
101 : felix 61 points = FALSE, lines = TRUE))
102 :    
103 :     ## seems not to work...
104 :     #xyplot(y ~ x, xy) +
105 : felix 64 # layer(panel.quantile(y ~ qss(x, lambda=1), method = "rqss"))
106 : felix 61 }
107 :     \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