Hansen(1999) Threshold Estimation in Panel Data

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

This is a replication file for Bruce Hansen(1999), "Threshold effects in non dynamic panels: estimation, testing and inference", Journal of Econometrics, vol 93, pp 345-368. It uses the PANELTHRESH procedure to estimate a fixed effects model allowing for up to two breaks in a specific regressor.

Two things to note:
  1. There was a bug in Hansen's original Gauss code which caused it to lose the last time period in each individual's data. This (or actually the PANELTHRESH procedure) handles this correctly.
  2. The bootstrapping (second part of the program) requires RATS version 8.1 or later as it is written.
panelthresh.rpf
Program file
(1.62 KiB) Downloaded 2695 times
invest.txt
Data file
(579.34 KiB) Downloaded 2500 times
dnfloro1
Posts: 9
Joined: Wed Sep 25, 2013 8:32 am

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by dnfloro1 »

Hi Tom,

How do I extend this code into a DYNAMIC PANEL?

Thanks in advance for your reply

DFLORO
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

dnfloro1 wrote:Hi Tom,

How do I extend this code into a DYNAMIC PANEL?

Thanks in advance for your reply

DFLORO
You don't. This relies upon repeated fixed effects regressions, which will be biased in the case of a dynamic panel.
nbcheikh
Posts: 9
Joined: Tue Apr 19, 2011 3:43 am

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by nbcheikh »

Hi Tom,
Is it possible to extend panel threshold test of Hansen (1999) to three breaks?
Thank you in advance,
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

nbcheikh wrote:Hi Tom,
Is it possible to extend panel threshold test of Hansen (1999) to three breaks?
Thank you in advance,
Possible? Yes. Easy? Not really. In order to keep the computational burden down, this searches for one break, then the second given the first, then the first (again) given the second. Hansen shows that that gives consistent estimates of the two breaks. That idea probably extends to three breaks, but it's a rather complicated set of calculations.

Why would you want that anyway? If there isn't evidence of a break allowing for two, why would you think three would be different?
nbcheikh
Posts: 9
Joined: Tue Apr 19, 2011 3:43 am

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by nbcheikh »

When I estimated my model I found an evidence of double threshold, so now I want to run the test for a third threshold as Hansen (1999) did in his paper.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

nbcheikh wrote:When I estimated my model I found an evidence of double threshold, so now I want to run the test for a third threshold as Hansen (1999) did in his paper.
Quite honestly, if the model shows two breaks, it probably already means that it's just wrong (wrong proxy, wrong specification or something else).
FaeK
Posts: 29
Joined: Tue Jan 03, 2012 8:01 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by FaeK »

Dear Tom,

I hope that you are well. I run the panelthresh procedure posted above and indeed it tests for single and double threshold effects. However, I am slighly confused as the estimated regression reports only one parameter on the breakvar. Do I need to construct interactive terms (slope dummies) based on the estimated thresholds from the procedure and then run the fixed effect regression to get the switching parameters on the breakvar? or I miss something in this respect. I apologise if this seems to be trivial, but I am not an expert with panel. Many thanks in advance for all the help- it is much appreciated.
Kind Regards, Faek
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

The point of the paper is to demonstrate how to test for break effects in a single regressor. All the other coefficients are treated as fixed. If you follow the links for the @PANELTHRESH procedure, you'll see that someone has previously asked about that.
FaeK
Posts: 29
Joined: Tue Jan 03, 2012 8:01 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by FaeK »

Dear Tom,
Many thanks for the prompt reply. Indeed, I am aware that it tests for a break in a single regressor. I am confused about how to get or estimate the switching parameters on this single regressor (a parameter when the regressor is above the threshold and one it is below the threshold) when the test supports the existence of one threshold effect. Many thanks, Faek.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

The procedure defines %%gamma1_1 as the best single break. So you just create something like

set cf0 = breakvar*(threshvar<=%%gamma1_1)
set cf1 = breakvar*(threshvar>%%gamma1_1)

(where breakvar and threshvar are your series), then run a PREG(METHOD=FIXED) with CF0 and CF1 replacing BREAKVAR in the regressor list.
Catife
Posts: 9
Joined: Sun Mar 20, 2016 10:18 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by Catife »

Hi Tom,

If I would like to detect the thresholds in a pooled panel estimation, is it correct to do so by modifying the panelthresh.rpf to be with preg(method=pooled)? Thank you.

Regards
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by TomDoan »

Catife wrote:Hi Tom,

If I would like to detect the thresholds in a pooled panel estimation, is it correct to do so by modifying the panelthresh.rpf to be with preg(method=pooled)? Thank you.

Regards
A pooled panel regression is just plain old OLS. The point of the Hansen paper is to handle fixed effects and also to deal with the fact that in a large panel data set the number of potential double threshold combinations may be (or may have been given the technology 20 years ago) prohibitively large for a exhaustive search. Note also that this is doing a threshold break in just one regressor. What exactly is it that you're trying to do?
Catife
Posts: 9
Joined: Sun Mar 20, 2016 10:18 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by Catife »

TomDoan wrote:
Catife wrote:Hi Tom,

If I would like to detect the thresholds in a pooled panel estimation, is it correct to do so by modifying the panelthresh.rpf to be with preg(method=pooled)? Thank you.

Regards
A pooled panel regression is just plain old OLS. The point of the Hansen paper is to handle fixed effects and also to deal with the fact that in a large panel data set the number of potential double threshold combinations may be (or may have been given the technology 20 years ago) prohibitively large for a exhaustive search. Note also that this is doing a threshold break in just one regressor. What exactly is it that you're trying to do?
Thank you for the reply. Actually, I just suspect there is no individual fixed effect in my model so that I would like to remove the fixed effect setup and see if the thresholds are robust. Therefore, I come to the estimation of pooled panel with thresholds.
stan076
Posts: 9
Joined: Mon Mar 27, 2017 10:37 pm

Re: Hansen(1999) Threshold Estimation in Panel Data

Unread post by stan076 »

Would it be an issue if the threshold variable is not country specific but a common variable to all country? (e.g. world commodity price )
Post Reply