View source: R/forecasting_gq.R
fitted.bmgarch | R Documentation |
Extracts the model-predicted means, variances, and correlations for the fitted data.
## S3 method for class 'bmgarch'
fitted(
object,
CrI = c(0.025, 0.975),
digits = 2,
weights = NULL,
inc_samples = FALSE,
...
)
object |
bmgarch object. |
CrI |
Numeric vector (Default: |
digits |
Integer (Default: 2, optional). Number of digits to round to when printing. |
weights |
Takes weights from model_weight function. Defaults to 1 – this parameter is not typically set by user. |
inc_samples |
Logical (Default: FALSE). Whether to return the MCMC samples for the fitted values. |
... |
Not used. |
Whereas forecast.bmgarch
computes the forecasted values for future time periods, fitted.bmgarch
computes the backcasted (model-predicted) values for the observed time periods.
fitted.bmgarch object. List containing meta
data and the backcast
. Backcast is a list containing three elements:
[N, 7, TS]
array of mean backcasts, where N is the timeseries length, and TS is the number of time series. E.g., bc$backcast$mean[3,,"tsA"]
is the mean backcast for the third observation in time series "tsA".
[N, 7, TS]
array of variance backcasts, where N is the timeseries length, and TS is the number of time series. E.g., bc$backcast$var[3,,"tsA"]
is the variance backcast for the third observation in time series "tsA".
[N, 7, TS(TS - 1)/2]
array of correlation backcasts, where N is the timeseries length, and TS(TS - 1)/2
is the number of correlations. E.g., bc$backcast$cor[3,, "tsB_tsA"]
is the backcast for the correlation between "tsB" and "tsA" on the third observation. Lower triangular correlations are saved.
List
. If inc_samples is TRUE
, then a list of arrays of MCMC samples for means, vars, and cors. Each array is [Iteration, Period, ..., ...].
## Not run:
data(panas)
# Fit CCC(1,1) and constant meanstructure.
fit <- bmgarch(panas, parameterization = "CCC", meanstructure = "constant")
# Obtain fitted values
fit.bc <- fitted(fit)
# Print fitted values
print(fit.bc)
# Plot fitted values (plot.bmgarch calls fitted internally)
plot(fit, type = "var")
# Save fitted values as data frame
fit.bc.df <- as.data.frame(fit.bc)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.