TVAR model with 3 regimes with 1 threshold state variable

Discussion of models with structural breaks or endogenous switching.
bok1234
Posts: 86
Joined: Tue Jan 11, 2011 8:14 pm

TVAR model with 3 regimes with 1 threshold state variable

Unread post by bok1234 »

Dear Mr.Doan,

I am working on ‘TVAR model with 3 regimes with 1 threshold state variable’ through modifying TVAR_IRF.rpf (Balke(2000)). First of all, please see my 2 pictures. Let’s suppose that ‘yellow zone (YZ)’ is the optimal band of foreign reserve (exogenous and not fixed for test horizon), ‘threshold state variable (black line)’ is actual foreign reserve, and dependent variable (red line) is exchange rate. Of course, these are all virtual data.


Question 1.
As you can see, because threshold values (upper limit and lower limit of yellow zone) are changing, RATS coding is not easy. So I converted from the first graph into the second graph in order to fix only one threshold value as zero. The second graph composed of 3 regimes - (1) Threshold State Variable > Upper Limit of YZ, (2) TSV in YZ, (3) TSV < Lower Limit of YZ. In this case I think that structural threshold VAR model could be as follow (modification of the first equation of Balke(2000)), Do you think that this is right?

Yt = A_1*Yt + B_1(L)*Yt-1 +
+ [ A_2*Yt + B_2(L)*Yt-1 ] * I_u [ TSV – upper limit of YZ > 0 ]
+ [ A_3*Yt + B_3(L)*Yt-1 ] * I_d [ TSV – lower limit of YZ < 0 ]
+ et

I_u : indicator function, if ‘TSV – upper limit of YZ’ > 0, then I_u = 1, otherwise I_u = 0
I_d : indicator function, if ‘TSV – upper limit of YZ’ > 0, then I_d = 1, otherwise I_d = 0



Question 2.
I want to code 3 variable (dependent variable(red), threshold state variable, another variable) TVAR with 3 regimes by 1 threshold state variable. Although I am trying to do this, this is never easy job – frankly speaking, I am not familiar with bootstrapping codes. Mr Doan, don’t you have already the code of 3 variable TVAR with 3 regimes by 1 threshold state variable? If you don’t, please give me some useful advices in coding this model as specific as possible. I already know that you referred to this a little when you uploaded TVAR_IRF.rpf on Jan. 14, 2014 in the RATS forum – you said that we don’t need to modify line 112~205 and line 212~315 of TVAR_IRF.rpf. However, this is TVAR model with 2 regimes by 1 threshold state variable. Therefore, I cannot apply it to my test without modifying much, perhaps, of the code. Related to this work, I also know that Darth Nisis, one of RATS users, uploaded 3 variable TVAR with 3 regimes on Oct. 19, 2015 in the RATS forum. I attached it for your convenience. But I am not sure whether this is the right code or not.
Attachments
the 1st graph
the 1st graph
To Doan 1.png (40.04 KiB) Viewed 13234 times
the 2nd graph
the 2nd graph
To Doan 2.png (48.41 KiB) Viewed 13234 times
tvar_pass_through_irf_2breaksinfla.RPF
code by Darth Nisis
(13.9 KiB) Downloaded 817 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by TomDoan »

Tsay JASA 1998 estimates a 3 branch TVAR. However, it doesn't do IRF's. I'm not sure I'm understanding how your model works. Are the threshold breaks known? It sounds from your description like they're exactly computable. In Balke's model (and Tsay's as well), the threshold variable is computable, but the break values are unknown and have to be found by a search procedure (for a three branch model, with a nested search for the two break values).
bok1234
Posts: 86
Joined: Tue Jan 11, 2011 8:14 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by bok1234 »

1. Yes, the threshold breaks are all known – these are some given numbers like policy maker’s targets. So, I don’t need to run TVAR_estimate.rpf.

2. (Question) a three branch model in your reply means a three regime model?

3. (Question) I had already known that Tsay developed multiple threshold model and downloded tsayjasa1998.zip from the RATS site. However, I think that Tsay’s homogeneous covariance assumption has some weak point, that is, lackness of reality in regime change model. So, this makes me hesitate to use tsayjasa1998.zip. Nevertheless, I guess that you recommended the persons who are not familiar with bootstrapping like me to use tsayjasa1998.zip. My guessing is right?

4. Even though I cannot code Balke type TVAR model with 3 regimes by 1 state variable at this time, I still need your answer about the first one of yesterday questions.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by TomDoan »

bok1234 wrote:1. Yes, the threshold breaks are all known – these are some given numbers like policy maker’s targets. So, I don’t need to run TVAR_estimate.rpf.
Correct. That would be estimated by three separate ESTIMATE instructions, each with a SMPL option for the particular branch. That would estimate the model with separate covariance matrices in each regime.
bok1234 wrote: 2. (Question) a three branch model in your reply means a three regime model?
bok1234 wrote: 3. (Question) I had already known that Tsay developed multiple threshold model and downloded tsayjasa1998.zip from the RATS site. However, I think that Tsay’s homogeneous covariance assumption has some weak point, that is, lackness of reality in regime change model. So, this makes me hesitate to use tsayjasa1998.zip. Nevertheless, I guess that you recommended the persons who are not familiar with bootstrapping like me to use tsayjasa1998.zip. My guessing is right?
No. Tsay doesn't do any bootstrapping because it doesn't really do anything that requires it---it's a much less ambitious paper.
bok1234 wrote: 4. Even though I cannot code Balke type TVAR model with 3 regimes by 1 state variable at this time, I still need your answer about the first one of yesterday questions.
If the break conditions are known, then you just write that as a FRML for the SMPL options on the estimation. Is your switching condition endogenous (is generated from the Y variables in the VAR) or exogenous? If it's the latter, for IRF's, you really would just do a separate IRF for each of the regimes. Balke's condition is endogenous, which is why he needs to go to simulation methods for computing the IRF's.
bok1234
Posts: 86
Joined: Tue Jan 11, 2011 8:14 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by bok1234 »

1. As you recommended me last time, I downloaded and skimmed Tsay (1998), Tsay (1989), tsayjasa1998.zip and tsaytest.src. I guess that ‘figure 2. response of output to shocks, conditional on regime’ of Balke(2000) matches ‘table 4 (p.1193),’ ‘table 9 (p.1197),’ and ‘table 11 (p.1201)’ of Tsay(1998). Am I right?

2. The outputs, that is, ‘table 4 (p.1193),’ ‘table 9 (p.1197),’ and ‘table 11 (p.1201)’ of Tsay(1998) were produced by ‘tsaytest.src’?

3. As I referred before, threshold values (switching conditions) of my test are known – that is to say, exogenous and already given. If threshold values are known, 'TVAR_IRF.rpf,' 'TVAR_ESTIMATE.rpf,' 'iceland_river.rpf' and 'usrates.rpf' are meaningless?

4. When you reply to me last time, you said as below.
“If the break conditions are known, then you just write that as a FRML for the SMPL options on the estimation.” This hint is not enough for me to code 3 regime TVAR with 2 known (exogenous) threshold values. As a matter of fact, due to given threshold values my test might not be TVAR any more. I just want to test VAR with 3 regimes by 1 threshold state variable (please see again my 2nd graph of my question on Jan 20. Please give me some part of specific example codes.

I always appreciate your help.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by TomDoan »

Both the Balke and Tsay TVAR's are being estimated with completely separate branches, rather than a main branch plus differences, i.e.

y(t)=A1(L)y(t) x regime1 dummy + A2(L)y(t) x regime2 dummy + A3(L)y(t) x regime 3 dummy.

where regime1, regime2 and regime 3 are 1-0 dummies which partition the data set. What you wrote in the initial post is the equivalent

y(t)=A0(L)y(t) + A2(L)y(t) x regime2 dummy + A3(L)y(t) x regime 3 dummy

but the first form is much more convenient if the three regimes have no common parameters (different lags, different covariance matrices) as you can just estimate with three separate ESTIMATE instructions each with a separate SMPL. Note that Balke does LINREG's equation by equation rather than ESTIMATE because he allows for (though doesn't actually use) different lag structures in different equations. (With mismatched equations, it would actually be more correct technically to use SUR to estimate the full system---with the empirical work done 20 years ago, it might have been seen as too complex for the computers of the day).

What exactly are the conditions governing the "high" and "low" branches in your TVAR, using the data in your data set? The code you originally posted was based upon someone else's desire to do use two different thresholds (thus 4 cases when allowing for the interactions), which is different from what you're doing.
bok1234
Posts: 86
Joined: Tue Jan 11, 2011 8:14 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by bok1234 »

Dear Mr.Doan,

1. Thank you for your fast reply. It helped me very much to settle my problem, particularly, related to my question 4 on Jan.23. By the way, can ESTIMATE instruction include SMPL as an option? In the section of ESTIMATE instruction, RATS online shows that it is ‘unused’ as follows; SMPL=Standard SMPL option [unused]

2. I still need you answers about my question 1, 2 and 3 on Jan.23. If you cannot find easily Balke (2000), Tsay (1998), and Tsay (1989), I will send you them or truncate related sections of each paper.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by TomDoan »

If you would answer my question (repeated below), I could answer all of your questions very easily. The problem is that you are doing a "square peg into a round hole". Tsay and Balke have unknown break points, which creates non-standard asymptotics for the test. Known breaks, no matter how they are generated, allows for standard (likelihood ratio) asymptotics. And exogenous breaks means that there is no need for bootstrapping or simulation to do IRF's.

What exactly are the conditions governing the "high" and "low" branches in your TVAR, using the data in your data set? The code you originally posted was based upon someone else's desire to do use two different thresholds (thus 4 cases when allowing for the interactions), which is different from what you're doing.
bok1234
Posts: 86
Joined: Tue Jan 11, 2011 8:14 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by bok1234 »

Dear Mr.Doan,

1. The conditions governing the ‘high’ and ‘low’ branches in my TVAR are just like policy makers’ targets as I referred on Jan. 20. Policy makers set the target zone after considering lots of factors which affect foreign reserve in my virtual example. I record again my example which I wrote on Jan. 20.

(repeated part begins)
First of all, please see my 2 pictures. Let’s suppose that ‘yellow zone (YZ)’ is the optimal band of foreign reserve (exogenous and not fixed for test horizon), ‘threshold state variable (black line)’ is actual foreign reserve, and dependent variable (red line) is exchange rate. Of course, these are all virtual data.
As you can see, because threshold values (upper limit and lower limit of yellow zone) are changing, RATS coding is not easy. So I converted from the first graph into the second graph in order to fix only one threshold value as zero. The second graph composed of 3 regimes - (1) Threshold State Variable > Upper Limit of YZ, (2) TSV within YZ, (3) TSV < Lower Limit of YZ. In this case I think that
structural threshold VAR model could be as follow (modification of the first equation of Balke(2000)), Do you think that this is right?

(I have modified the below equation reflecting your advice of Jan. 23)
Yt =[ A_1*Yt + B_1(L)*Yt-1 ] * I_w [ lower limit of YZ < TSV < upper limit of YZ’ ]
+ [ A_2*Yt + B_2(L)*Yt-1 ] * I_u [ TSV – upper limit of YZ > 0 ]
+ [ A_3*Yt + B_3(L)*Yt-1 ] * I_d [ TSV – lower limit of YZ < 0 ]
+ et
I_u : indicator function, if ‘lower limit of YZ < TSV < upper limit of YZ’ > 0,
then I_u = 1, otherwise I_u = 0
I_u : indicator function, if ‘TSV – upper limit of YZ’ > 0, then I_u = 1, otherwise I_u = 0
I_d : indicator function, if ‘TSV – upper limit of YZ’ < 0, then I_d = 1, otherwise I_d = 0
(repeated part ends)

2. You referred to someone else’s code – tvar_pass_through_irf_2breaksinfla.RPF by Darth Nisis. As far as I know Darth Nisis changed his original interest from TVAR with 4 regimes by 2 state variables to TVAR with 3 regimes by 1 state variable. He said that hIs code is for the latter.

3. Your explanation of today answered enough for my third question on Jan. 23.

4. Even though I am more interested in exogenous threshold model as of now, your answers about my question 1 & 2 on Jan. 23 are important for my future study on unknown threshold model. Please read them again. Later, I will compare ‘those known thresholds’ and ‘estimated thresholds through Tsay or Balke.’ Even though this might look ‘square peg in a round hole’, I will try to consider the meaning of the gap between actual limits and theoretical limits.

5. By the way, can ESTIMATE instruction include SMPL as an option? In the section of ESTIMATE instruction, RATS online shows that it is ‘unused’ as follows; SMPL=Standard SMPL option [unused]
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: TVAR model with 3 regimes with 1 threshold state variabl

Unread post by TomDoan »

SMPL=Standard SMPL option [unused]

The information in [...] is the default setting, so [unused] means that, by default, it is unused. It definitely exists. (We wouldn't include it in the documentation if it didn't).

Assuming TSV as the threshold variable, yzupper as the upper bound for the yellow zone and yzlower as the lower bound, the following would estimate the VAR in each of the three regimes:

estimate(smpl=tsv>yzupper)
estimate(smpl=tsv<yzlower)
estimate(smpl=tsv>=yzlower.and.tsv<=yzupper)
Post Reply