smooth_estimates | R Documentation |
Evaluate a smooth at a grid of evenly spaced value over the range of the
covariate associated with the smooth. Alternatively, a set of points at which
the smooth should be evaluated can be supplied. smooth_estimates()
is a new
implementation of evaluate_smooth()
, and should be used instead of that
other function.
smooth_estimates(object, ...) ## S3 method for class 'gam' smooth_estimates( object, smooth = NULL, n = 100, n_3d = NULL, n_4d = NULL, data = NULL, unconditional = FALSE, overall_uncertainty = TRUE, dist = NULL, unnest = TRUE, partial_match = FALSE, ... )
object |
an object of class |
... |
arguments passed to other methods. |
smooth |
character; a single smooth to evaluate. |
n |
numeric; the number of points over the range of the covariate at which to evaluate the smooth. |
n_3d, n_4d |
numeric; the number of points over the range of last
covariate in a 3D or 4D smooth. The default is |
data |
a data frame of covariate values at which to evaluate the smooth. |
unconditional |
logical; should confidence intervals include the
uncertainty due to smoothness selection? If |
overall_uncertainty |
logical; should the uncertainty in the model constant term be included in the standard error of the evaluate values of the smooth? |
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 |
unnest |
logical; unnest the smooth objects? |
partial_match |
logical; in the case of character |
A data frame (tibble), which is of class "smooth_estimates"
.
load_mgcv() dat <- data_sim("eg1", n = 400, dist = "normal", scale = 2, seed = 2) m1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML") ## evaluate all smooths smooth_estimates(m1) ## or selected smooths smooth_estimates(m1, smooth = c("s(x0)", "s(x1)"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.