Hansen-Seo(2002), Threshold cointegration
This is a replication file for Hansen and Seo(2002), "Testing for two-regime threshold cointegration in vector error-correction models", J of Econometrics, vol 110, pp 293-318. Compared with Balke-Fomby(1997) (http://www.estima.com/forum/viewtopic.php?f=8&t=1062) this doesn't take the cointegrating vector as known and unlike Enders-Siklos(2001) (http://www.estima.com/forum/viewtopic.php?f=8&t=1110), it estimates the cointegrating vector and threshold together, rather than using a two-step process. That makes for a rather complicated estimation process, requiring a double grid search (over beta's, then, given beta, over threshold values). The likelihood function is highly discontinuous, so slightly different grids can produce quite different results.
Updated 28 October 2011 to add an option from graphing the beta vs log det sigma and to correct an error in the grid search for beta.
Updated 28 October 2011 to add an option from graphing the beta vs log det sigma and to correct an error in the grid search for beta.