panel.ci | R Documentation |
Panel function for confidence interval
panel.ci(
x,
y,
lower,
upper,
groups = NULL,
subscripts,
col,
fill = if (is.null(groups)) plot.line$col else superpose.line$col,
alpha = 0.15,
lty = 0,
lwd = if (is.null(groups)) plot.line$lwd else superpose.line$lwd,
grid = FALSE,
...,
col.line = if (is.null(groups)) plot.line$col else superpose.line$col
)
x, y |
variables to be plotted in the scatterplot |
lower |
lower confidence limits |
upper |
upper confidence limits |
groups |
an optional grouping variable. If present,
|
subscripts |
see |
col |
line color |
fill |
fill color |
alpha |
opacity for the fill |
lty |
line type |
lwd |
line width |
grid |
A logical flag, character string, or list specifying whether and how
a background grid should be drawn. This provides the same
functionality as Most generally,
No grid is drawn if |
... |
Extra arguments, if any, for |
col.line |
line color. Supersedes |
mod <- lm(Petal.Width ~ Petal.Length * Species, data = iris)
newdat <- expand.grid(
Petal.Length = seq(1, 7, by = 0.1),
Species = c("setosa", "versicolor", "virginica")
)
pred <- predict(mod, newdat, interval = "confidence")
dd <- cbind(newdat, pred)
xyplot(
fit ~ Petal.Length,
groups = Species, data = dd,
prepanel = prepanel.ci, auto.key = list(lines = TRUE, points = FALSE),
ylab = "Petal Width",
xlab = "Petal Length",
lower = dd$lwr, upper = dd$upr, type = "l",
panel = function(...) {
panel.ci(..., alpha = 0.15, grid = TRUE)
panel.xyplot(...)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.