Skip to content

ENH: state space: optional use of Lutkepohl 2010 info. criteria - #3514

Merged
ChadFulton merged 2 commits into
statsmodels:masterfrom
ChadFulton:lutkepohl-stats
Feb 27, 2017
Merged

ChadFulton merged 2 commits into
statsmodels:masterfrom
ChadFulton:lutkepohl-stats

Conversation

@ChadFulton

Copy link
Copy Markdown
Member

Add the option to specify computing AIC, BIC, and HQIC using Lutkepohl's (2010) alternate formulas.

Notes for consideration / review:

  • Right now, the keyword argument (passed to fit, filter, or smooth) is lutkepohl_stats, default is False.
  • As in the AR / ARIMA / VAR models, I used the true number of parameters (including constant and variance parameters) rather than just the AR / VAR coefficients. This is as opposed to Stata, which ignore the constant and variance parameters in the IC penalty term.
  • Unit tests are against Stata and use the SARIMAX and VARMAX models as their examples. In the unit tests I adjust the IC so that the numbers are comparable to Stata.

@josef-pkt

Copy link
Copy Markdown
Member

Why is lutkepohl_stats needed as a fit keyword? Shouldn't this be a results method?

@josef-pkt

Copy link
Copy Markdown
Member

(don't forget to add labels to issues and PRs)

@ChadFulton

Copy link
Copy Markdown
Member Author

Why is lutkepohl_stats needed as a fit keyword? Shouldn't this be a results method?

It could be. I guess I'm still not sure exactly how the results class should operate.

  • The original way I implemented it was as a results property, where the property setter (e.g. results.lutkepohl_stats = True reset the cache for aic, bic, hqic variables so that when they were next called they would return the Lutkepohl versions. Unfortunately, it looks like the wrapper doesn't work with properties.
  • I guess I could change this to a use_lutkepohl_stats method or something.
  • Or should I have different attributes? e.g. aic_lutkepohl?

I thought I remembered some discussion about covariance matrices, that there was a movement away from e.g. _get_robustcov_results returning a whole new results instance? So I thought it was better to specify lutkepohl_stats in the construction of the class, which means in fit.

But I really have no preference here, happy to implement it whatever way is consistent with Statsmodels.

@ChadFulton

ChadFulton commented Feb 26, 2017 •

Copy link
Copy Markdown
Member Author

Whoops, didn't include the new results / testing files. Amended commit includes them.

@josef-pkt

Copy link
Copy Markdown
Member

a few thoughts

In general, post-fit results should be in the results class, but the results instance is created in fit so it's the only place we can add things to results.__init__. This was the outcome of the cov_type and use_t decision.
However, I think we should keep those fit keywords to a small number as possible, especially also because it doesn't make it easy to get the non-default result version without calling fit again.

three possibilities:

  • add specific keyword like cov_type to fit
  • use a more generic keyword in fit like results_defaults_kwds requiring a dict (similar to cov_kwds)
  • limit the use of defaults and use explicit methods in results

my guess is that information criteria should be in the third case. It doesn't look to me important enough to switch between different ic definitions by default, or is it?
Given that aic, bic are attributes, we could add a separate method for information criteria to the results for different versions, e.g. VAR uses a ic method.

The only place where defaults are really visible is the summary method, and we have some options in those cases, like alpha for the confidence interval.
It might be useful to define a results attribute summary_options if we want to have or give users more flexibility about what is used by defaults (without having to specify a large set of arguments) (I thought there is a related issue for changing what's in the results, but don't find any.)

If the ic versions produce different rankings of models, then they would also affect model selection, which would be a different usage of the defaults than summary.

aside: AIC, BIC in GLM is still inconsistent because they use two different definitions.

@coveralls

coveralls commented Feb 26, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.007%) to 90.289% when pulling 59b4c46 on ChadFulton:lutkepohl-stats into ab03a63 on statsmodels:master.

@ChadFulton

Copy link
Copy Markdown
Member Author

Adding an ic method makes sense to me. So I'll keep the usual tools.eval_measures aic, bic, hqic as the attributes, and allow in the ic method switching through a method keyword argument; with 'standard' (default) or 'lutkepohl' as options.

@ChadFulton

Copy link
Copy Markdown
Member Author

Oh, I guess I'll make the method name info_criteria for compatibility with VAR.

@ChadFulton

Copy link
Copy Markdown
Member Author

Oh, I guess I'll make the method name info_criteria for compatibility with VAR.

Never mind,info_criteria is an attribute in VAR. So, I guess ic it is for the method.

@josef-pkt

Copy link
Copy Markdown
Member

just in general: the current VAR is not a very good example for consistent informative names (and has quite a bit of refactorings waiting in PRs)

ic is a bit short for my taste
I think we could change it in VAR, info_criteria sounds like a good method name.

@ChadFulton

Copy link
Copy Markdown
Member Author

Force pushed an amend, which adds a new info_criteria method.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 90.288% when pulling 9e17d65 on ChadFulton:lutkepohl-stats into ab03a63 on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 90.288% when pulling 9e17d65 on ChadFulton:lutkepohl-stats into ab03a63 on statsmodels:master.

@ChadFulton

Copy link
Copy Markdown
Member Author

This looks good to me now, will merge later tonight unless there are concerns.

Comment thread statsmodels/tsa/statespace/mlemodel.py Outdated
method : {'standard', 'lutkepohl'}
The method for information criteria computation. Default is
'standard' method; 'lutkepohl' computes the information criteria
as in Lutkepohl (2010). See Notes for formulas.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the references have Lutkepohl 2007
?

Comment thread statsmodels/tsa/statespace/mlemodel.py Outdated

References
----------
.. [1] Lutkepohl, Helmut. 2007.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get the utf-8 correct spelling of the name?

@josef-pkt

Copy link
Copy Markdown
Member

looks good to me based on skimming

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 90.288% when pulling 9b1b0ca on ChadFulton:lutkepohl-stats into ab03a63 on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 90.288% when pulling 9b1b0ca on ChadFulton:lutkepohl-stats into ab03a63 on statsmodels:master.

@ChadFulton
ChadFulton merged commit 8d5c8f2 into statsmodels:master Feb 27, 2017
@ChadFulton

Copy link
Copy Markdown
Member Author

Thanks for the review @josef-pkt

@ChadFulton
ChadFulton deleted the lutkepohl-stats branch February 27, 2017 03:32
@josef-pkt josef-pkt added this to the 0.9 milestone May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants