residuals function

Extract Residuals of Bayesian GVAR

Extract Residuals of Bayesian GVAR

Calculate residuals of the global model and the country models.

## S3 method for class 'bgvar' residuals(object, ...) ## S3 method for class 'bgvar' resid(object, ...)

Arguments

  • object: A fitted bgvar object.
  • ...: Additional arguments.

Returns

Returns a list with the following arguments

  • global: A (T-p) times K times draws/thin array containing the residuals of the global model.
  • country: A (T-p) times K times draws/thin array containing the residuals of the country models.
  • Data: A (T-p) times K matrix containing the data of the model.

Details

This function calculates residuals of the global and the country models based on a bgvar object. Country models' residuals are equivalent to output generated by the print.bgvar function in case no trimming has been used. If trimming was invoked to discard unstable draws output of both functions might differ since print.bgvar calculates residuals as a running mean to save storage which is based on the whole set of posterior draws (including discarded draws). In this case it is recommended to recalculate the residuals with residuals.bgvar and re-do the serial autocorrelation or average pairwise cross-correlation analysis using functions resid.corr.test and avg.pair.cc.

Examples

library(BGVAR) data(testdata) model.ng <- bgvar(Data=testdata,W=W.test,plag=1,draws=100,burnin=100) resid(model.ng) resid(model.ng)

See Also

bgvar for estimation of a bgvar object.

Author(s)

Maximilian Boeck, Martin Feldkircher

  • Maintainer: Maximilian Boeck
  • License: GPL-3
  • Last published: 2024-09-30