Description Usage Arguments Value Author(s) Examples
Plots estimated smooths from a fitted GAM model in a similar way to
mgcv::plot.gam()
but instead of using base graphics, ggplot2::ggplot()
is used instead.
1 2 3 4 |
object |
a fitted GAM, the result of a call to |
select |
character; |
scales |
character; should all univariate smooths be plotted with the
same y-axis scale? The default, |
align |
characer; see argument |
n |
numeric; the number of points over the range of the covariate at which to evaluate the smooth. |
unconditional |
logical; should confidence intervals include the uncertainty due to smoothness selection? If |
inc.mean |
logical; should the uncertainty in the model constant term be included in the standard error of the evaluate values of the smooth? Currently not implemented. |
dist |
numeric; if greater than 0, this is used to determine when
a location is too far from data to be plotted when plotting 2-D smooths.
The data are scaled into the unit square before deciding what to exclude,
and |
... |
arguments passed to |
A ggplot2::ggplot()
object.
Gavin L. Simpson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library("mgcv")
set.seed(2)
dat <- gamSim(1, n = 400, dist = "normal", scale = 2)
m1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML")
draw(m1)
set.seed(2)
dat <- gamSim(2, n = 4000, dist = "normal", scale = 1)
m2 <- gam(y ~ s(x, z, k = 30), data = dat$data, method = "REML")
draw(m2)
dat <- gamSim(4)
m3 <- gam(y ~ fac + s(x2, by = fac) + s(x0), data = dat)
draw(m3, scales = "fixed")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.