| ppc.mvgam | R Documentation |
Plot conditional posterior predictive checks from mvgam models
ppc(object, ...)
## S3 method for class 'mvgam'
ppc(
object,
newdata,
data_test,
series = 1,
type = "hist",
n_bins,
legend_position,
xlab,
ylab,
...
)
object |
|
... |
Further |
newdata |
Optional |
data_test |
Deprecated. Still works in place of |
series |
|
type |
|
n_bins |
|
legend_position |
The location may also be specified by setting x to a single keyword from the list "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". This places the legend on the inside of the plot frame at the given location. Or alternatively, use "none" to hide the legend. |
xlab |
Label for x axis |
ylab |
Label for y axis |
Conditional posterior predictions are drawn from the fitted
mvgam and compared against the empirical distribution of the
observed data for a specified series to help evaluate the model's ability
to generate unbiased predictions. For all plots apart from
type = 'rootogram', posterior predictions can also be compared to out
of sample observations as long as these observations were included as
'data_test' in the original model fit and supplied here. Rootograms are
currently only plotted using the 'hanging' style.
Note that the predictions used for these plots are conditional on
the observed data, i.e. they are those predictions that have been
generated directly within the mvgam() model. They can be misleading if
the model included flexible dynamic trend components. For a broader range
of posterior checks that are created using unconditional "new data"
predictions, see pp_check.mvgam
A base R graphics plot showing either a posterior rootogram
(for type == 'rootogram'), the predicted vs observed mean for the
series (for type == 'mean'), predicted vs observed proportion of
zeroes for the series (for type == 'prop_zero'), predicted vs
observed histogram for the series (for type == 'hist'), kernel
density or empirical CDF estimates for posterior predictions (for
type == 'density' or type == 'cdf') or a Probability
Integral Transform histogram (for type == 'pit').
Nicholas J Clark
pp_check.mvgam, predict.mvgam
## Not run:
# Simulate some smooth effects and fit a model
set.seed(0)
dat <- mgcv::gamSim(
1,
n = 200,
scale = 2
)
mod <- mvgam(
y ~ s(x0) + s(x1) + s(x2) + s(x3),
data = dat,
family = gaussian(),
chains = 2,
silent = 2
)
# Posterior checks
ppc(mod, type = "hist")
ppc(mod, type = "density")
ppc(mod, type = "cdf")
# Many more options are available with pp_check()
pp_check(mod)
pp_check(mod, type = "ecdf_overlay")
pp_check(mod, type = "freqpoly")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.