How to estimate the threshold VAR model?

I'm using toolbox of threshold VAR model devloped by Gabriel Bruneau
I tried the following syntax for the selction of threshold VAR model as described in the code
ic = tvarxic(y,8,2,([0 1]),'SBIC')
The first argument is my input which is a matrix of two variables with 268 observations, next to it there is the maximum lags followed by by the number of theresholds. Then there is a vector to spicify the transition variable, 1 indicates for the variable to be taken as transition variable. The last argument is for the information criteria
However, every time I run the code, I got the following error
Error using tvarxic
Expected input number 4, transVar, to be an array with number of rows equal to 268.
Error in tvarxic>checkInput (line 279)
validateattributes(transVar,{'numeric'},{'real','nrows',size(y,1),'ncols',1},'tvarxic','transVar',4);
Error in tvarxic (line 82)
[y,nARmax,nThreshmax,transVar] = checkInput(y,nARmax,nThreshmax,transVar);
I tried many things but I'm getting the same error, could anyone please check and tell me what I'm doing wrong here
Any help is deeply appreciated

답변 (1개)

pan chao pan
pan chao pan 2019년 8월 27일

0 개 추천

hello,you can send me the model,I can help you.763133807@qq.com

댓글 수: 6

Thanks, I'll send the data as soon as possible, before estimating the model I'd like to select the best features to estimate the model such as time delay and the optimal lag lenght which can be obtained using the syntax
[icVar,infocrit,tresh] = tvarxic(y,nARmax,nThreshmax,transVar,options_ic,options_tvarx)
Then estimate the model and plot the impulse response function at each regime, I'll be so grateful if you helped me to solve these issues.
Hi, could you fix it? I have the same problem
Hamid Muili
Hamid Muili 2020년 12월 31일
Dear Ameer Fahmi, pls try to post the solution to the problem so that some of us having similar issue will learn from it too Best regards
Ameer Fahmi
Ameer Fahmi 2020년 12월 31일
Unfortunately, I haven't been able to figure out what the problem is, so I moved on and I used another application of TVAR models
Hamid Muili
Hamid Muili 2021년 4월 5일
What other TVAR toolbox did you use. Please.
Hamid Muili
Hamid Muili 2021년 4월 5일
Finally I was able to fix it. Just create a matrix of logical expression in MATLAB. For example, if y contains my data set 100*4 for 4 variables with 100 observation. And I want to use the first column variable as the treshold variable. Just create a matrix of logical expression. Treshvar= [true, false,false, false]. This tells MATLAB that it should only use the first variable as the treshold variable.

댓글을 달려면 로그인하십시오.

질문:

2019년 5월 1일

댓글:

2021년 4월 5일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by