You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am fitting a VECM(lag=1) model with 2 variables, and than I run simulations using parameters of that model.
My starting values for the simulation should be the last values of the original series.
According to the error messages of TVECM.sim starting values "Should have nrow = lag and ncol = number of variables".
So I provide a 1 x 2 matrix as a starting value (I take the last row of the original timeseries).
In the results of the simulation I can see:
in the first row my original starting values
in the second row: 0, 0
from the third row the simulation begins, but that second row with zeros makes the simulation unrealistic.
I've checked the code of TVECM.sim, and it seems, that indeed simulations begins from i=lag+2.
I believe the problem is, that starting values should have rather lag+1 x k dimensions instead of lag x k dimensions.
I was able to make my simulation realistic by changing 2 rows in TVECM.sim function (but please don't assume it's a sure fix, I'm just rather following what dim VECMsim_unrealistic_simulation.R.txt
ensions of matrices suggest).
The changes are in the initialization of simulation (changing p -> p+1):
if (!is.null(starting)) {
if (all(dim(as.matrix(starting)) == c(nB, p+1)))
y[seq_len(p+1), ] <- starting
else stop("Bad specification of starting values. Should have nrow = lag+1 and ncol = number of variables")
}
I have no issues simulating VAR models (VAR.sim).
Converting VECM models to VAR (VARrep function) and then using VAR.sim also works.
Attached is an example of fitting VECM than simulating.
EDIT: x4 should be x2 in the attached code (I'm not able to modify attachment).
Hello,
I am fitting a VECM(lag=1) model with 2 variables, and than I run simulations using parameters of that model.
My starting values for the simulation should be the last values of the original series.
According to the error messages of TVECM.sim starting values "Should have nrow = lag and ncol = number of variables".
So I provide a 1 x 2 matrix as a starting value (I take the last row of the original timeseries).
In the results of the simulation I can see:
I've checked the code of TVECM.sim, and it seems, that indeed simulations begins from i=lag+2.
I believe the problem is, that starting values should have rather lag+1 x k dimensions instead of lag x k dimensions.
I was able to make my simulation realistic by changing 2 rows in TVECM.sim function (but please don't assume it's a sure fix, I'm just rather following what dim
VECMsim_unrealistic_simulation.R.txt
ensions of matrices suggest).
The changes are in the initialization of simulation (changing p -> p+1):
I have no issues simulating VAR models (VAR.sim).
Converting VECM models to VAR (VARrep function) and then using VAR.sim also works.
Attached is an example of fitting VECM than simulating.
EDIT: x4 should be x2 in the attached code (I'm not able to modify attachment).
Than you,
Greg
VECMsim_unrealistic_simulation.R.txt
The text was updated successfully, but these errors were encountered: