View source: R/plot_mvgam_smooth.R
plot_mvgam_smooth | R Documentation |
This function plots posterior empirical quantiles for a series-specific smooth term
plot_mvgam_smooth(
object,
trend_effects = FALSE,
series = 1,
smooth,
residuals = FALSE,
n_resid_bins = 25,
realisations = FALSE,
n_realisations = 15,
derivatives = FALSE,
newdata
)
object |
|
trend_effects |
logical. If |
series |
|
smooth |
either a |
residuals |
|
n_resid_bins |
|
realisations |
|
n_realisations |
|
derivatives |
|
newdata |
Optional |
Smooth functions are shown as empirical quantiles (or spaghetti plots) of posterior partial expectations
across a sequence of values between the variable's min
and max
,
while zeroing out effects of all other variables. At present, only univariate and bivariate smooth plots
are allowed, though note that bivariate smooths rely on default behaviour from
plot.gam
. plot_mvgam_smooth
generates posterior predictions from an
object of class mvgam
, calculates posterior empirical quantiles and plots them.
If realisations = FALSE
, the returned plot shows 90, 60, 40 and 20 percent posterior
quantiles (as ribbons of increasingly darker shades or red) as well as the posterior
median (as a dark red line). If realisations = FALSE
, a set of n_realisations
posterior
draws are shown. For more nuanced visualisation, supply
newdata
just as you would when predicting from a gam
model or use the more flexible conditional_effects.mvgam
. Alternatively, if you prefer to use partial
effect plots in the style of gratia
, and if you have the gratia
package installed, you can
use draw.mvgam
. See gratia_mvgam_enhancements
for details.
A base R
graphics plot
Nicholas J Clark
plot.gam
, conditional_effects.mvgam
,
gratia_mvgam_enhancements
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.