Description Usage Arguments Value Author(s) Examples
Plots estimated univariate and bivariate smooths using ggplot2.
1 2 3 4 5 6 7 8 9 10 11 12 | ## S3 method for class 'evaluated_1d_smooth'
draw(object, xlab, ylab, title = NULL,
subtitle = NULL, caption = NULL, ...)
## S3 method for class 'evaluated_2d_smooth'
draw(object, show = c("estimate", "se"),
contour = TRUE, xlab, ylab, title = NULL, subtitle = NULL,
caption = NULL, ...)
## S3 method for class 'evaluated_re_smooth'
draw(object, qq_line = TRUE, xlab, ylab,
title = NULL, subtitle = NULL, caption = NULL, ...)
|
object |
an object, the result of a call to |
xlab |
character or expression; the label for the x axis. If not
supplied, a suitable label will be generated from |
ylab |
character or expression; the label for the y axis. If not
supplied, a suitable label will be generated from |
title |
character or expression; the title for the plot. See
|
subtitle |
character or expression; the subtitle for the plot. See
|
caption |
character or expression; the plot caption. See
|
... |
arguments passed to other methods. |
show |
character; plot the estimated smooth ( |
contour |
logical; should contours be draw on the plot using
|
qq_line |
logical; draw a reference line through the lower and upper theoretical quartiles. |
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")
sm <- evaluate_smooth(m1, "s(x2)")
draw(sm)
set.seed(2)
dat <- gamSim(2, n = 4000, dist = "normal", scale = 1)
m2 <- gam(y ~ s(x, z, k = 40), data = dat$data, method = "REML")
sm <- evaluate_smooth(m2, "s(x,z)", n = 100)
draw(sm)
## now the standard error the smooth instead
draw(sm, show = "se")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.