create_svar_data: Create data using a structural VAR

Description Usage Arguments Value Details Note See Also Examples

View source: R/SVAR-1-simulation.R

Description

Given some starting values, coefficients, a sequence of structural error vectors, and a matrix of contemporaneous impact effects of those errors, create_varp_data will compute a sequence of observables using a simple vector autoregressive process.

Usage

1
create_svar_data(A, B, Y0, W)

Arguments

A

A (K x Kp) matrix, providing the coeffcients for lag 1 to p with the first row containing the coefficents of the first equation. Parameter p is the maximum lag length and K the number of variables.

B

A (K x K) matrix, providing the contemporaneous impact of the structural errors on the observed variables.

Y0

A (K x p) matrix which will be used as starting values. The first column corresponds to the very first time period.

W

A (K x N) matrix, providing the sequence of structural error vectors.

Value

A (K x N+p) matrix holding the observations. The first p columns will be equal to Y0. Column p + 1 will be equal to A \\%*\\% Y0 + U[, 1], where U contains reduced form errors. The final observation of the K variables will be in column N+p.

Details

Note

For a faster implementation, see this solution by Dirk Eddelbuettel.

See Also

Other functions for creating data: create_varp_data

Examples

1
2
3
4
5
6
7
8
9
K <- 3
N <- 1E3
p <- 2

A <- cbind(matrix(0.1, K, K), matrix(-0.05, K, K)); diag(A) <- 0.4
B <- matrix(0.4, K, K); B[upper.tri(B)] <- 0
Y0 <-matrix(0, nrow = K, ncol = p)
set.seed(8191)
W <- matrix(rnorm(N * K), nrow = K, ncol = N)

nielsaka/zeitreihe documentation built on March 17, 2020, 8:38 p.m.