specify_prior_bsvarSIGN {bsvarSIGNs} | R Documentation |
The class PriorBSVARSIGN presents a prior specification for the homoskedastic bsvar model.
p
a positive integer - the number of lags.
hyper
a (N+3)xS
matrix of hyper-parameters \mu, \delta, \lambda, \psi
.
A
a NxK
normal prior mean matrix for the autoregressive
parameters.
V
a KxK
matrix determining the normal prior column-specific
covariance for the autoregressive parameters.
S
an NxN
matrix determining the inverted-Wishart prior scale
of error terms covariance matrix.
nu
a positive scalar greater than N+1
- the shape of the
inverted-Wishart prior for error terms covariance matrix.
data
an TxN
matrix of observations.
Y
an NxT
matrix of dependent variables.
X
an KxT
matrix of independent variables.
Ysoc
an NxN
matrix with the sum-of-coefficients dummy observations.
Xsoc
an KxN
matrix with the sum-of-coefficients dummy observations.
Ysur
an NxN
matrix with the single-unit-root dummy observations.
Xsur
an KxN
matrix with the single-unit-root dummy observations.
mu.scale
a positive scalar - the shape of the gamma prior for \mu
.
mu.shape
a positive scalar - the shape of the gamma prior for \mu
.
delta.scale
a positive scalar - the shape of the gamma prior for \delta
.
delta.shape
a positive scalar - the shape of the gamma prior for \delta
.
lambda.scale
a positive scalar - the shape of the gamma prior for \lambda
.
lambda.shape
a positive scalar - the shape of the gamma prior for \lambda
.
psi.scale
a positive scalar - the shape of the inverted gamma prior for \psi
.
psi.shape
a positive scalar - the shape of the inverted gamma prior for \psi
.
new()
Create a new prior specification PriorBSVAR.
specify_prior_bsvarSIGN$new( data, p, exogenous = NULL, stationary = rep(FALSE, ncol(data)) )
data
the TxN
data matrix of observations.
p
a positive integer - the autoregressive lag order of the SVAR model.
exogenous
a Txd
matrix of exogenous variables.
stationary
an N
logical vector - its element set to FALSE
sets
the prior mean for the autoregressive parameters of the N
th equation to the white noise process,
otherwise to random walk.
A new prior specification PriorBSVARSIGN.
# 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
get_prior()
Returns the elements of the prior specification PriorBSVAR as a list
.
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
estimate_hyper()
Estimates hyper-parameters with adaptive Metropolis algorithm.
specify_prior_bsvarSIGN$estimate_hyper( S = 10000, burn_in = S/2, mu = FALSE, delta = FALSE, lambda = TRUE, psi = FALSE )
S
number of MCMC draws.
burn_in
number of burn-in draws.
mu
whether to estimate the hyper-parameter in the sum-of-coefficients dummy prior.
delta
whether to estimate the hyper-parameter in the single-unit-root dummy prior.
lambda
whether to estimate the hyper-parameter of the shrinkage in the Minnesota prior.
psi
whether to estimate the hyper-parameter of the variances in the Minnesota prior.
# 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)
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvarSIGN$clone(deep = FALSE)
deep
Whether to make a deep clone.
# 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)