Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sm.stats.acorr_ljungbox(res.wresid) needs helpful return #286

Closed
josef-pkt opened this issue May 28, 2012 · 4 comments · Fixed by #6324
Closed

sm.stats.acorr_ljungbox(res.wresid) needs helpful return #286

josef-pkt opened this issue May 28, 2012 · 4 comments · Fixed by #6324

Comments

@josef-pkt
Copy link
Member

sm.stats.acorr_ljungbox returns the values for all lags, this can be difficult to interpret.

A recommended answer would be easier to interpret. What's the recommended lag to look at?

Also acorr_ljungbox or similar should be added to summary() as more powerful alternative to Durbin-Watson, (DW doesn't have p-value)

@jseabold
Copy link
Member

Box and Jenkins recommends that the lag be long enough so that the 'weights' go to zero. I think where

w_t = \phi^{-1}(B)\theta(B)a_t=\psi(B)a_t

In any event, in the examples I've seen the Q-stat is either never significant blows up at higher lag-lengths so it's obvious there are problems. I think stata's default is 40 as with the other corrgram type functions.

@jseabold jseabold modified the milestones: 0.7, 0.6 Sep 26, 2014
@jseabold
Copy link
Member

Not a release blocker.

@josef-pkt
Copy link
Member Author

http://stats.stackexchange.com/questions/200267/interpreting-ljung-box-test-results-from-statsmodels-stats-diagnostic-acorr-lju/200283#200283

some links from the answer

"
Hyndman http://robjhyndman.com/hyndsight/ljung-box-test/ recommends min(10, T/5) for non-seasonal time series. His simulations show that ljung-box overrejects if the lag length is too large.

Stata uses min(n/2 − 2, 40) http://www.stata.com/manuals13/tswntestq.pdf

It looks like in R the default number of lags depends on which package is used.

This http://www.r-bloggers.com/story-of-the-ljung-box-blues-progress-not-perfection/ shows a similar pattern of p-values decreasing with lag length.
"

@josef-pkt josef-pkt modified the milestones: 0.8, 0.7 Mar 7, 2016
@josef-pkt
Copy link
Member Author

docstring is wrong: maxlag is hardcoded at 41, but docstring has copy paste error
"If lags is None, then the default maxlag is 12*(nobs/100)^{1/4}"

@bashtage bashtage self-assigned this Dec 5, 2019
bashtage added a commit to bashtage/statsmodels that referenced this issue Dec 6, 2019
Move to return a DataFrame in the future
Reduce lags to agree with Hyndaman

closes statsmodels#286
xref statsmodels#3381
bashtage added a commit to bashtage/statsmodels that referenced this issue Dec 6, 2019
Move to return a DataFrame in the future
Reduce lags to agree with Hyndaman

closes statsmodels#286
xref statsmodels#3381
bashtage added a commit to bashtage/statsmodels that referenced this issue Dec 6, 2019
Move to return a DataFrame in the future
Reduce lags to agree with Hyndaman

closes statsmodels#286
xref statsmodels#3381
bashtage added a commit to bashtage/statsmodels that referenced this issue Dec 6, 2019
Move to return a DataFrame in the future
Reduce lags to agree with Hyndaman

closes statsmodels#286
xref statsmodels#3381
bashtage added a commit to bashtage/statsmodels that referenced this issue Dec 7, 2019
Move to return a DataFrame in the future
Reduce lags to agree with Hyndaman

closes statsmodels#286
xref statsmodels#3381
@bashtage bashtage modified the milestones: 0.8, 0.11 Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants