fitted_values | R Documentation |
Generate fitted values from a estimated GAM
fitted_values(object, ...) ## S3 method for class 'gam' fitted_values( object, data = NULL, scale = c("response", "link", "linear predictor"), ci_level = 0.95, ... )
object |
a fitted model. Currently only models fitted by |
... |
arguments passed to |
data |
optional data frame of covariate values for which fitted values are to be returned. |
scale |
character; what scale should the fitted values be returned on?
|
ci_level |
numeric; a value between 0 and 1 indicating the coverage of the credible interval. |
A tibble (data frame) whose first m columns contain either the data
used to fit the model (if data
was NULL
), or the variables supplied to
data
. Four further columns are added:
fitted
: the fitted values on the specified scale,
se
: the standard error of the fitted values (always on the link scale),
lower
, upper
: the limits of the credible interval on the fitted values,
on the specified scale.
Regardless of the scale on which the fitted values are returned, the
se
component of the returned object is on the link (linear predictor)
scale, not the response scale.
load_mgcv() sim_df <- data_sim("eg1", n = 400, dist = "normal", scale = 2, seed = 2) m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = sim_df, method = "REML") fv <- fitted_values(m) fv
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.