Description
Original Launchpad bug 677947: https://bugs.launchpad.net/statsmodels/+bug/677947
Reported by: josef-pktd (joep).
see thread starting Oct17 2010, Comparing models
proposal by Thomas Wiecki
For now I made two methods out of it compare_f_test and
compare_lr_test both attached to regression results
I think, compare_lr_test will go higher up in the class hierarchy so
that it is also available for maximum likelihood models.
I like the more explicit names, but shorter names might be possible
In the simple example, compare_f_test produces exactly the same result
as f_test with the corresponding restriction matrix, as it should for
linear models. Likelihood Ratio test results are close to f_test but I
don't have an exact test for it yet.
Activity
jseabold commentedon Sep 18, 2012
Is this still open?
josef-pkt commentedon Sep 18, 2012
compare_lr_test should move up to LikelihoodModelResults
looking at it, I think we need an extra argument that allows that lrdf, the number of restriction for the degrees of freedom, can be overwritten. currently relies on the information in df_resid
jseabold commentedon Sep 20, 2014
Still relevant?
josef-pkt commentedon Sep 20, 2014
moving to 0.7
still relevant, and there are several other issues open, e.g. #1314
main problem why it's not just adding the current version to the LikelihoodModel is that in most references they recommend keeping some nuisance parameters like scale or covariance/weighting matrix fixed during the comparison. We have that in the linear model, IIRC, but not generically.
main underlying refactoring issue is, for example, how to get the loglike given a fixed scale #1776
RLM, and quasi-likelihood (GLM) will get it's own compare methods of "LR-type"
ispmarin commentedon Jul 31, 2015
Any news if this will make into 0.7?
josef-pkt commentedon Jul 31, 2015
@ispmarin I haven't planned on adding it in 0.7. Saket opened a PR for adding it to the base models #2440, but I'm still not sure whether this works for a wide enough set of subclasses.
We could add it to specific models, or find a way to warn users when it (most likely) doesn't apply in their case.
For which models are you interested in the compare method?.
ispmarin commentedon Jul 31, 2015
Reading the pull request I got the impression that this should work only for likelihood based models. Is that true? I was wondering about doing the comparison of a more general model comparison, like two ARIMAs with different parameters.
josef-pkt commentedon Jul 31, 2015
Yes,
compare_LR_testis only designed for LikelihoodModels. There are equivalents in a few other model types (RLM, and GLM-Quasi-Likelihood).(Related detail: Even for likelihood model it's only correct if the parameters are in the interior of the parameter space. For example, it cannot be directly used to test that a variance is 0.)
However, ARIMA is a Maximum Likelihood Model, and I'm pretty sure the standard definition as in compare_LR_test should be correct for comparing models with different lags. Note AIC and BIC for ARIMA type models has the same comparison of loglikelihood structure as the LR test.
Implementation detail: the current method might use degrees of freedom attribute that might not be available in the tsa models.
ispmarin commentedon Jul 31, 2015
Thanks for the comments. I asked about the 0.7 milestone because this might be useful for me and it says there on the "Milestone".
Also, just wondering: what is the policy about issues open for a long time?
josef-pkt commentedon Aug 1, 2015
They stay open until someone provides a solution. Some of the issues especially those with label design are general reminders about improving the design to generalize or expand to new models and new use cases, and won't have a clear answer.
For example, adding
compare_lr_testwould be a "manageable" issue, that doesn't need guessing whether it applies to a large group of models and options.All issues with 0.7 milestones that are not prio-high should be 0.8, but I don't have a script yet to relabel them automatically.