This function is from the superseded package tidymv. Please, use the tidygam package instead.
It plots the smooths from the estimates of a gam or bam object.
plot_smooths(
model,
series,
comparison = NULL,
facet_terms = NULL,
conditions = NULL,
exclude_random = TRUE,
exclude_terms = NULL,
series_length = 25,
split = NULL,
sep = "\.",
transform = NULL,
ci_z = 1.96,
time_series
)
A [ggplot][ggplot2::ggplot] object.
A gam
or bam
model object.
An unquoted expression indicating the model term that defines the series on which smoothing is applied. This is the term that is displayed on the x-axis when plotting.
An unquoted expression indicating the model term for which the comparison will be plotted.
An unquoted formula with the terms used for faceting.
A list of quosures with quos
specifying the levels to plot from the model terms not among series
, comparison
, or facet_terms
.
Whether to exclude random smooths (the default is TRUE
).
Terms to be excluded from the prediction. Term names should be given as they appear in the model summary (for example, "s(x0,x1)"
).
An integer indicating how many values along the time series to use for predicting the outcome term.
Columns to separate as a named list.
Separator between columns (default is "\\."
, which is the default with ). If character, it is interpreted as a regular expression.
Function used to transform the fitted values (useful for getting plots on the response scale).
The z-value for calculating the CIs (the default is 1.96
for 95 percent CI).
Deprecated, use series
instead.
library(mgcv)
set.seed(10)
data <- gamSim(4)
model <- gam(y ~ fac + s(x2) + s(x2, by = fac) + s(x0), data = data)
plot_smooths(model, x2, fac)
# alternative model specification
model <- gam(y ~ s(fac, bs = "re") + s(x2) + s(x2, by = fac) + s(x0), data = data)
plot_smooths(model, x2, fac)
# For details, see vignette
if (FALSE) {
vignette("plot-smooths", package = "tidymv")
}
Run the code above in your browser using DataLab