Dear Professors,
Please, I have been trying to use a loop in finding an average point that gives a threshold effect on the dependent variable giving a criterion (such as lowest AIC or BIC).
Y = a + bX + c(X-X*) + eWhere Y is the dependent variable, and X is the independent variable.
Please, if anyone has ever done something like appreciate it if the code can be shared.
Hi,
I'm attaching code that I wrote some years ago, implementing (parts of) "Estimation and model selection based inference in single and multiple threshold models", Jesus Gonzalo, Jean-Yves Pitarakis, Journal of Econometrics 110 (2002) 319–352.
In that setup there's a separately chosen threshold series which --given the estimated threshold value(s)-- determines in each observation the regime where you currently are. If I understand your setup correctly, you want the single series X to serve both as the regressor and at the same time as the threshold series. In principle you would then have to call my function like this:
estim_thresh( Y, X, X, 1)
But I haven't tested if this case actually works.
I guess this stuff could also be turned into a function package -- if someone wants to learn and practice how to do it, be my guest and go ahead, I have no problem that this code is used.
While digging around my harddisk, I also found some prototype code for the Hansen (2000) approach, but that doesn't appear to be ready to run...
Hope this helps
Sven