Page 1 of 7

Balke(2000) Threshold VAR

Posted: Mon Jan 13, 2014 11:14 am
by TomDoan
This is a replication file for Balke(2000), "Credit and Economic Activity: Credit Regimes and Nonlinear Propagation of Shocks," Review of Economics and Statistics, vol 82, 344-349. One program finds the optimal threshold and the second computes the non-linear IRF's as described in the paper, averaging responses across all observed periods in a given regime. (This is set for doing the upper regime; changing upper=1 to upper=0 in the initial part will switch this).

This is covered in detail as part of the 2nd Edition of the Structural Breaks and Switching Models course.

Zip with programs/data

Detailed description

Re: Balke(2000) Threshold VAR

Posted: Sun Feb 08, 2015 10:19 pm
by kathywangyan
Dear Tom,

I have some questions about the codes given.

Taking into account the nonlinear characteristic of TVAR model, how should i modify the irf codes to obtain the response of y to one unit or 1% GDP shock? In the codes given, the shock are 1 or 2 SD, and it will be wrong if i just rescaled the response of y to 1 SD shock, in order to obtain the response of y to 1% GDP shock. How should i modify the irf part of the codes if i want the shock to be fixed at 1% GDP or other value?

Thank you very much for your help! :)

sincerely yours
yan wang

Re: Balke(2000) Threshold VAR

Posted: Mon Feb 09, 2015 12:03 pm
by TomDoan
Balke's model and, in particular, his bootstrap method doesn't really lend itself to that because the covariance matrix switches as well, so everything needs to be standardized to unit standard deviations.

Re: Balke(2000) Threshold VAR

Posted: Mon Feb 09, 2015 7:55 pm
by kathywangyan
TomDoan wrote:Balke's model and, in particular, his bootstrap method doesn't really lend itself to that because the covariance matrix switches as well, so everything needs to be standardized to unit standard deviations.
Thank you very much. So it is possible to fixed the shock to be equal to 1% GDP using other simulate methods, for example the MCMC method in paper "state-dependent effects of fiscal policy"(Fazzari et at 2014), am i right?

Another question :) . In the RATS codes given, for the whole forecast horizon ( irf horizon) the forecast model would be fixed (either upper regime or lower regime), is it possible to modify the codes so that for certain initial start (either upper or lower), the forecast model could switch according to the forecast value of the endogenous credit variable which is also the threshold variable. Actually, as a result of the shock, the forecast value of credit variable could become larger or smaller and then may also switch the model to the other.

Re: Balke(2000) Threshold VAR

Posted: Tue Feb 10, 2015 11:02 am
by TomDoan
kathywangyan wrote:
TomDoan wrote:Balke's model and, in particular, his bootstrap method doesn't really lend itself to that because the covariance matrix switches as well, so everything needs to be standardized to unit standard deviations.
Thank you very much. So it is possible to fixed the shock to be equal to 1% GDP using other simulate methods, for example the MCMC method in paper "state-dependent effects of fiscal policy"(Fazzari et at 2014), am i right?
That's correct. The MCMC procedure takes the data as given, which avoids the problem of having to re-flate standardized residuals.
kathywangyan wrote: Another question :) . In the RATS codes given, for the whole forecast horizon ( irf horizon) the forecast model would be fixed (either upper regime or lower regime), is it possible to modify the codes so that for certain initial start (either upper or lower), the forecast model could switch according to the forecast value of the endogenous credit variable which is also the threshold variable. Actually, as a result of the shock, the forecast value of credit variable could become larger or smaller and then may also switch the model to the other.
TVAR_IRF is basically doing that, though it does the added step of averaging across initial conditions rather than just going with one. It generates simulated processes and switches regimes based upon the simulated values. That's what's happening with:
do i=1,nvar
   frml tvarf(i) depvars(i) = %if(thrfrml{d}>thresh,$
        fitud(&i,1)+%dot(%xrow(sup,&i),bootres),$
        fitud(&i,2)+%dot(%xrow(sdn,&i),bootres))
end do i

Re: Balke(2000) Threshold VAR

Posted: Wed Oct 07, 2015 8:48 am
by Darth Nisis
Hi Tom

I´m trying to modify this code in order to estimate a multiple breaks TVAR model. In order to do so, first i need to calculate the appropriate thresholds values.
Suppose I wish to calculate simultaneously two thresholds values, for two different threshold variables, so that observations of the model will be grouped in four different regimes:

Regime 1: Threshold variable "A" above Threshold vale "a" + Threshold variable "B" above Threshold value "b".

Regime 2: Threshold variable "A" above Threshold vale "a" + Threshold variable "B" below Threshold value "b".

Regime 3: Threshold variable "A" below Threshold vale "a" + Threshold variable "B" above Threshold value "b".

Regime 4: Threshold variable "A" below Threshold vale "a" + Threshold variable "B" below Threshold value "b".

I attach you my modified code. Although the code runs ok, I´m not sure if its actually doing what i want it to do.

Best Regards!

Juan

Re: Balke(2000) Threshold VAR

Posted: Wed Oct 07, 2015 7:07 pm
by TomDoan
This won't work:

sweep(var=hetero,group=(yma{d}<thresh1)+(xma{d}<thresh2)) rstart rend

You need to multiply one of the two test criteria (doesn't really matter which) by 2 to get a "binary representation" of the regime, i.e.

sweep(var=hetero,group=(yma{d}<thresh1)+2*(xma{d}<thresh2)) rstart rend

which will have group value 0 for both less, group value 1 for y<thresh1, x>thresh2, group value 2 for y>thresh1 and x<thresh2 and group value 3 for both >. Also, as you have that written, both the thresholds move together. If you want those chosen completely independently, then you need a double nested loop (over pientry and pientryx for instance).

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 19, 2015 7:22 am
by Darth Nisis
TomDoan wrote:This won't work:

sweep(var=hetero,group=(yma{d}<thresh1)+(xma{d}<thresh2)) rstart rend

You need to multiply one of the two test criteria (doesn't really matter which) by 2 to get a "binary representation" of the regime, i.e.

sweep(var=hetero,group=(yma{d}<thresh1)+2*(xma{d}<thresh2)) rstart rend

which will have group value 0 for both less, group value 1 for y<thresh1, x>thresh2, group value 2 for y>thresh1 and x<thresh2 and group value 3 for both >. Also, as you have that written, both the thresholds move together. If you want those chosen completely independently, then you need a double nested loop (over pientry and pientryx for instance).
Dear Tom

Thanks for your response, it was very helpful. I find the threshold values that i needed, and using the same logic you suggested, I was able to adapt the other code and estimate a multiple threasholds TVAR model. I attach the program for any fellow RATS user that wish to try it (in the code i attach, there are essentially 3 regimes, not 4, because now I´m using the exact same threshold variable, with two different breaks, for the final estimation).

Re: Balke(2000) Threshold VAR

Posted: Mon Oct 19, 2015 10:35 am
by Darth Nisis
TomDoan wrote:Balke's model and, in particular, his bootstrap method doesn't really lend itself to that because the covariance matrix switches as well, so everything needs to be standardized to unit standard deviations.
Dear Tom

One more question. In Balke´s model, a 1 SD shock in variable X for a given regime, corresponds to the 1 SD for such variable for the whole model, or only for the specific regime? In other words, a 1 SD shock has the same size across regimes, or its different?

Best Regards,

Juan

Re: Balke(2000) Threshold VAR

Posted: Thu Feb 04, 2016 2:48 pm
by haydory
Hi Tom.

I have used the RATS code you created for the following paper "Credit and Economic Activity: Credit Regimes and Nonlinear Propagation of Shocks," Review of Economics and Statistics, vol 82, 344-349 for my research. Thank you so much. I have been trying to find the critical values for the threshold value. As I read Balke (2000) I think he is replicating the critical values using Bruce Hansen's procedure. I can find the Hansen procedure from the forum but they are for TAR. Since in the above paper it uses a TVAR, how do we obtain the critical values? I will sincerely appreciate your thoughts on this.

Thanks

Re: Balke(2000) Threshold VAR

Posted: Thu Feb 04, 2016 3:36 pm
by TomDoan
The tvar_test.rpf program does a fixed regressor bootstrap, which is Hansen's procedure. While the specific example in Hansen's paper is for a TAR, the idea extends to multivariate models as well. For instance, Hansen-Seo(2002) uses that for threshold cointegration.

Re: Balke(2000) Threshold VAR

Posted: Sun Feb 07, 2016 7:12 pm
by haydory
Hi Tom.

Thanks once again. I am a bit confused from your response. Is there a procedure in RATS tvar_test.rpf which does the simulation of the critical values? I could not find it. I can find for a single equation case. Please advice.

Thanks

Haydory Akbar Ahmed

Re: Balke(2000) Threshold VAR

Posted: Sun Feb 07, 2016 10:22 pm
by TomDoan
Starting at the comment line that says "Fixed regressor bootstrap" it does the fixed regressor bootstrap for the TVAR model being studied.

Re: Balke(2000) Threshold VAR

Posted: Mon Jul 18, 2016 10:22 pm
by Darth Nisis
Hi Tom

Would it be possible to adapt the code ir order to estimate the model with non-Gaussian errors? Would it be necessary to use of maximize instruction?

Thanks,

Juan

Re: Balke(2000) Threshold VAR

Posted: Tue Jul 19, 2016 9:41 am
by TomDoan
Since it's a multivariate regression, there aren't really all that many options for non-Gaussian distributions and there are no simple algorithms for doing the estimation---it's a full-scale likelihood maximization across all the parameters of the (two branches) of the VAR. Plus, I would doubt that you would end up with a threshold itself being much different if you did.