| specify_prior_bsvarSIGN {bsvarSIGNs} | R Documentation |
R6 Class Representing PriorBSVAR
Description
The class PriorBSVARSIGN presents a prior specification for the homoskedastic bsvar model.
Public fields
pa positive integer - the number of lags.
hypera
(N+3)xSmatrix of hyper-parameters\mu, \delta, \lambda, \psi.Aa
NxKnormal prior mean matrix for the autoregressive parameters.Va
KxKmatrix determining the normal prior column-specific covariance for the autoregressive parameters.San
NxNmatrix determining the inverted-Wishart prior scale of error terms covariance matrix.nua positive scalar greater than
N+1- the shape of the inverted-Wishart prior for error terms covariance matrix.dataan
TxNmatrix of observations.Yan
NxTmatrix of dependent variables.Xan
KxTmatrix of independent variables.Ysocan
NxNmatrix with the sum-of-coefficients dummy observations.Xsocan
KxNmatrix with the sum-of-coefficients dummy observations.Ysuran
NxNmatrix with the single-unit-root dummy observations.Xsuran
KxNmatrix with the single-unit-root dummy observations.mu.scalea positive scalar - the shape of the gamma prior for
\mu.mu.shapea positive scalar - the shape of the gamma prior for
\mu.delta.scalea positive scalar - the shape of the gamma prior for
\delta.delta.shapea positive scalar - the shape of the gamma prior for
\delta.lambda.scalea positive scalar - the shape of the gamma prior for
\lambda.lambda.shapea positive scalar - the shape of the gamma prior for
\lambda.psi.scalea positive scalar - the shape of the inverted gamma prior for
\psi.psi.shapea positive scalar - the shape of the inverted gamma prior for
\psi.
Methods
Public methods
Method new()
Create a new prior specification PriorBSVAR.
Usage
specify_prior_bsvarSIGN$new( data, p, exogenous = NULL, stationary = rep(FALSE, ncol(data)) )
Arguments
datathe
TxNdata matrix of observations.pa positive integer - the autoregressive lag order of the SVAR model.
exogenousa
Txdmatrix of exogenous variables.stationaryan
Nlogical vector - its element set toFALSEsets the prior mean for the autoregressive parameters of theNth equation to the white noise process, otherwise to random walk.
Returns
A new prior specification PriorBSVARSIGN.
Examples
# a prior for 5-variable example with one lag and stationary data data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$B # show autoregressive prior mean
Method get_prior()
Returns the elements of the prior specification PriorBSVAR as a list.
Usage
specify_prior_bsvarSIGN$get_prior()
Examples
# a prior for 5-variable example with four lags prior = specify_prior_bsvar$new(N = 5, p = 4) prior$get_prior() # show the prior as list
Method estimate_hyper()
Estimates hyper-parameters with adaptive Metropolis algorithm.
Usage
specify_prior_bsvarSIGN$estimate_hyper( S = 10000, burn_in = S/2, mu = FALSE, delta = FALSE, lambda = TRUE, psi = FALSE )
Arguments
Snumber of MCMC draws.
burn_innumber of burn-in draws.
muwhether to estimate the hyper-parameter in the sum-of-coefficients dummy prior.
deltawhether to estimate the hyper-parameter in the single-unit-root dummy prior.
lambdawhether to estimate the hyper-parameter of the shrinkage in the Minnesota prior.
psiwhether to estimate the hyper-parameter of the variances in the Minnesota prior.
Examples
# specify the model and set seed
set.seed(123)
data(optimism)
prior = specify_prior_bsvarSIGN$new(optimism, p = 4)
# estimate hyper parameters with adaptive Metropolis algorithm
prior$estimate_hyper(S = 10, psi = TRUE)
# trace plot
hyper = t(prior$hyper)
colnames(hyper) = c("mu", "delta", "lambda", paste("psi", 1:5, sep = ""))
plot.ts(hyper)
Method clone()
The objects of this class are cloneable with this method.
Usage
specify_prior_bsvarSIGN$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
# a prior for 5-variable example with one lag
data(optimism)
prior = specify_prior_bsvarSIGN$new(optimism, p = 1)
prior$A # show autoregressive prior mean
## ------------------------------------------------
## Method `specify_prior_bsvarSIGN$new`
## ------------------------------------------------
# a prior for 5-variable example with one lag and stationary data
data(optimism)
prior = specify_prior_bsvarSIGN$new(optimism, p = 1)
prior$B # show autoregressive prior mean
## ------------------------------------------------
## Method `specify_prior_bsvarSIGN$get_prior`
## ------------------------------------------------
# a prior for 5-variable example with four lags
prior = specify_prior_bsvar$new(N = 5, p = 4)
prior$get_prior() # show the prior as list
## ------------------------------------------------
## Method `specify_prior_bsvarSIGN$estimate_hyper`
## ------------------------------------------------
# specify the model and set seed
set.seed(123)
data(optimism)
prior = specify_prior_bsvarSIGN$new(optimism, p = 4)
# estimate hyper parameters with adaptive Metropolis algorithm
prior$estimate_hyper(S = 10, psi = TRUE)
# trace plot
hyper = t(prior$hyper)
colnames(hyper) = c("mu", "delta", "lambda", paste("psi", 1:5, sep = ""))
plot.ts(hyper)