Learn R Programming

mvgam (version 1.1.51)

hindcast.mvgam: Extract hindcasts for a fitted mvgam object

Description

Extract hindcasts for a fitted mvgam object

Usage

hindcast(object, ...)

# S3 method for mvgam hindcast(object, type = "response", ...)

Value

An object of class mvgam_forecast containing hindcast distributions. See mvgam_forecast-class for details.

Arguments

object

list object of class mvgam or jsdgam. See mvgam()

...

Ignored

type

When this has the value link (default) the linear predictor is calculated on the link scale. If expected is used, predictions reflect the expectation of the response (the mean) but ignore uncertainty in the observation process. When response is used, the predictions take uncertainty in the observation process into account to return predictions on the outcome scale. When variance is used, the variance of the response with respect to the mean (mean-variance relationship) is returned. When type = "terms", each component of the linear predictor is returned separately in the form of a list (possibly with standard errors, if summary = TRUE): this includes parametric model components, followed by each smooth component, but excludes any offset and any intercept. Two special cases are also allowed: type latent_N will return the estimated latent abundances from an N-mixture distribution, while type detection will return the estimated detection probability from an N-mixture distribution

Details

Posterior retrodictions are drawn from the fitted mvgam and organized into a convenient format

See Also

forecast.mvgam

Examples

Run this code
# \donttest{
simdat <- sim_mvgam(n_series = 3, trend_model = AR())
mod <- mvgam(y ~ s(season, bs = 'cc'),
             trend_model = AR(),
             noncentred = TRUE,
             data = simdat$data_train,
             chains = 2,
             silent = 2)

# Hindcasts on response scale
hc <- hindcast(mod)
str(hc)
plot(hc, series = 1)
plot(hc, series = 2)
plot(hc, series = 3)

# Hindcasts as expectations
hc <- hindcast(mod, type = 'expected')
str(hc)
plot(hc, series = 1)
plot(hc, series = 2)
plot(hc, series = 3)

# Estimated latent trends
hc <- hindcast(mod, type = 'trend')
str(hc)
plot(hc, series = 1)
plot(hc, series = 2)
plot(hc, series = 3)
# }

Run the code above in your browser using DataLab