Hansen's (1992) specification test for Markov regimes
Hansen's (1992) specification test for Markov regimes
Hello everyone,
I encountered a small problem while writing the Likelihood Ratio Test under nonstandard conditions as outlined by Hansen (1992) (http://ideas.repec.org/a/jae/japmet/v7y ... 61-82.html). I want to test whether I need n or n+1 states in my Markov chain. As might be well-known, the critical values of the LR test do not follow a chi-squared distribution due to the nuisance parameters involved. A careful review of the forum and the available procedures for RATS makes me believe that there is no ready-made solution. Is that correct?
The test is, however, fairly simple to implement from my point of view. Hansen suggests to standardize the LR test statistic by the standard deviation of the single log likelihoods ratios for the single observations. And there is the problem. Somewhere in the maximum likelihood estimation procedure of the Markov regime-switching model's EM algorythm, RATS calculates the log likelihoods to sum them up and to get to the overall log likelihood for the estimation. Is it possible to call these up? Because the model converged and, hence, they should be there. From my point of view, it should be easy to run both models, the one with n and the other with n+1 states, save the single likelihoods, calculate the standard deviation of the differences and then standardize the LR statistic.
Alternatively, I already tried to calculate the log-likelihood ratios manually by using the residuals and the explained variable of my regression, but it didn't work. I encounter some errors due to the fact that some errors (msregu) are larger than the y-variable eventually leading to values larger than 1, which cannot be used in a log.
I hope that my problem became clear. Otherwise, please comment on it and I'll respond and clarify whatever might unclear.
I encountered a small problem while writing the Likelihood Ratio Test under nonstandard conditions as outlined by Hansen (1992) (http://ideas.repec.org/a/jae/japmet/v7y ... 61-82.html). I want to test whether I need n or n+1 states in my Markov chain. As might be well-known, the critical values of the LR test do not follow a chi-squared distribution due to the nuisance parameters involved. A careful review of the forum and the available procedures for RATS makes me believe that there is no ready-made solution. Is that correct?
The test is, however, fairly simple to implement from my point of view. Hansen suggests to standardize the LR test statistic by the standard deviation of the single log likelihoods ratios for the single observations. And there is the problem. Somewhere in the maximum likelihood estimation procedure of the Markov regime-switching model's EM algorythm, RATS calculates the log likelihoods to sum them up and to get to the overall log likelihood for the estimation. Is it possible to call these up? Because the model converged and, hence, they should be there. From my point of view, it should be easy to run both models, the one with n and the other with n+1 states, save the single likelihoods, calculate the standard deviation of the differences and then standardize the LR statistic.
Alternatively, I already tried to calculate the log-likelihood ratios manually by using the residuals and the explained variable of my regression, but it didn't work. I encounter some errors due to the fact that some errors (msregu) are larger than the y-variable eventually leading to values larger than 1, which cannot be used in a log.
I hope that my problem became clear. Otherwise, please comment on it and I'll respond and clarify whatever might unclear.
Re: Hansen's (1992) specification test for Markov regimes
You can evaluate just the element-by-element log likelihoods at the final values with
set(start=(pstar=%MSVARInit())) twostate gstart gend = msvarf(t)
(in the hamilton.rpf example--it will be similar with other MS models).
set(start=(pstar=%MSVARInit())) twostate gstart gend = msvarf(t)
(in the hamilton.rpf example--it will be similar with other MS models).
Re: Hansen's (1992) specification test for Markov regimes
Thanks a lot! Works perfectly. I figured something like that would work, but I forgot to put the (t) behind the logl.
Anyways, thank you for the quick reply!
Anyways, thank you for the quick reply!
Re: Hansen's (1992) specification test for Markov regimes
If you get it working, could you post it? I've never finished an example of that.
Re: Hansen's (1992) specification test for Markov regimes
I'll do so as soon as I finished the paper. My source is working, but it's not optimized, yet.