Learn R Programming

bvarsv (version 1.1)

sim.var1.sv.tvp: Simulate from a VAR(1) with Stochastic Volatility and Time-Varying Parameters

Description

Simulate from a VAR(1) with Stochastic Volatility and Time-Varying Parameters

Usage

sim.var1.sv.tvp(B0 = NULL, A0 = NULL, Sig0 = NULL, Q = NULL, S = NULL, W = NULL, t = 500, init = 1000)

Arguments

B0
Initial values of mean parameters: Matrix of dimension $[M, M+1]$, where the first column holds the intercept vector and the other columns hold the matrix of first-order autoregressive coefficients. By default (NULL), B0 corresponds to $M = 2$ uncorrelated zero-mean processes with moderate persistence (first-order autocorrelation of $0.6$).
A0
Initial values for (transformed) error correlation parameters: Vector of length $0.5*M*(M-1)$. Defaults to a vector of zeros.
Sig0
Initial values for log error term volatility parameters: Vector of length $M$. Defaults to a vector of zeros.
Q, S, W
Covariance matrices for the innovation terms in the time-varying parameters ($B, A, Sig$). The matrices are symmetric, with dimensions equal to the number of elements in $B, A$ and $Sig$, respectively. Default to diagonal matrices with very small terms (1e-10) on the main diagonal. This corresponds to essentially no time variation in the parameters and error term matrix elements.
t
Number of time periods to simulate.
init
Number of draws to initialize simulation (to decrease the impact of starting values).

Value

data
Simulated data, with rows corresponding to time and columns corresponding to the $M$ system variables.
Beta
Array of dimension $[M, M+1, t]$. Submatrix $[,,l]$ holds the parameter matrix for time period $l$.
H
Array of dimension $[M, M, t]$. Submatrix $[,,l]$ holds the error term covariance matrix for period $l$.

References

Primiceri, G.E. (2005): `Time Varying Structural Vector Autoregressions and Monetary Policy', Review of Economic Studies 72, 821-852.

See Also

bvar.sv.tvp can be used to fit a model on data generated by sim.var1.sv.tvp. This can be a useful way to analyze the performance of the estimation methods.

Examples

Run this code
## Not run: 
# 
# # Generate data from a model with moderate time variation in the parameters 
# # and error term variances
# set.seed(5813)
# sim <- sim.var1.sv.tvp(Q = 1e-5*diag(6), S = 1e-5*diag(1), W = 1e-5*diag(2))
# # Plot both series
# matplot(sim$data, type = "l")
# # Plot AR(1) parameters of both equations
# matplot(cbind(sim$Beta[1,2,], sim$Beta[2,3,]), type = "l")
# 
# ## End(Not run)

Run the code above in your browser using DataLab