[R-SIG-Finance] Problem understanding the code of dse::simulate
Degang WU
samuelandjw at gmail.com
Fri Jan 22 17:17:44 CET 2016
Hi,
I want to simulate a VAR process using the following code
library(dse)
AR <- array(c(1, .5, .3, 0, .2, .1, 0, .2, .05, 1, .5, .3) ,c(3,2,2))
VAR <- ARMA(A=AR, B=diag(1,2))
print(VAR)
simData <- simulate(VAR)
Inside dse::simulate:
if (p == 1)
invA0 <- matrix(1/A[1, , ], 1, 1)
else invA0 <- solve(A[1, , ])
for (l in 1:a) A[l, , ] <- invA0 %*% A[l, , ]
for (l in 1:b) B[l, , ] <- invA0 %*% B[l, , ]
Where A[,,,] are the coefficient matrix for the process. I have no idea why the inverse of A[1, ,] is involved in the simulation.
Thanks!
Regards,
Degang
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list