-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
DOC: Clarify output size in statsmodels.tsa.stattools.acf #7818
Comments
I think it is because the ACF is well defined for lag 0 (it is the variance) while the q-stat and its p-value are not defined for 0 lags. Docs could be improved. |
The ACF for lag 0 is 1 if I'm not mistaken, and is therefore trivial? |
Yes, sorry. Was thinking of autocov rather than autocorr. But still well defined. Of course, has no estimation error too. Probably not worth the pain to change these to match. |
I understand, thanks! |
I made a few smal changes in 7927, that build on your commits. Thanks for this. |
Autocorrelation output size is inconsistent using statsmodels.tsa.stattools.acf
The statsmodels.tsa.stattools.acf function returns nlags+1 values for the acf and confint return variables (because it includes the output at lag 0 (ie., acf=1)) but nlags values for the qstat and values return variables. I see this as needlessly confusing and easily fixed by making all outputs of size nlags or all of size nlags+1. If otherwise there is a reason for this, I'd love to be educated!
Code Sample, a copy-pastable example if possible
Output
len(acf) 8
len(confint) 8
len(qstat) 7
len(pvalues) 7
Expected Output
len(acf) 7
len(confint) 7
len(qstat) 7
len(pvalues) 7
or
len(acf) 8
len(confint) 8
len(qstat) 8
len(pvalues) 8
Output of
import statsmodels.api as sm; sm.show_versions()
[paste the output of
import statsmodels.api as sm; sm.show_versions()
here below this line]INSTALLED VERSIONS
Python: 3.7.12.final.0
OS: Linux 5.4.104+ #1 SMP Sat Jun 5 09:50:34 PDT 2021 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
Statsmodels
Installed: 0.10.2 (/usr/local/lib/python3.7/dist-packages/statsmodels)
Required Dependencies
cython: 0.29.24 (/usr/local/lib/python3.7/dist-packages/Cython)
numpy: 1.19.5 (/usr/local/lib/python3.7/dist-packages/numpy)
scipy: 1.4.1 (/usr/local/lib/python3.7/dist-packages/scipy)
pandas: 1.1.5 (/usr/local/lib/python3.7/dist-packages/pandas)
dateutil: 2.8.2 (/usr/local/lib/python3.7/dist-packages/dateutil)
patsy: 0.5.2 (/usr/local/lib/python3.7/dist-packages/patsy)
Optional Dependencies
matplotlib: 3.2.2 (/usr/local/lib/python3.7/dist-packages/matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: 1.2.7 (/usr/local/lib/python3.7/dist-packages/cvxopt)
joblib: 1.0.1 (/usr/local/lib/python3.7/dist-packages/joblib)
Developer Tools
IPython: 5.5.0 (/usr/local/lib/python3.7/dist-packages/IPython)
jinja2: 2.11.3 (/usr/local/lib/python3.7/dist-packages/jinja2)
sphinx: 1.8.5 (/usr/local/lib/python3.7/dist-packages/sphinx)
pygments: 2.6.1 (/usr/local/lib/python3.7/dist-packages/pygments)
pytest: 3.6.4 (/usr/local/lib/python3.7/dist-packages)
virtualenv: Not installed
The text was updated successfully, but these errors were encountered: