Repository navigation
ENH: Add additional options for pacf ols - #5153
Conversation
| return pacf, sigma2 | ||
|
|
||
|
|
||
| #NOTE: this is incorrect. |
There was a problem hiding this comment.
This comment has been a huge bother. Very glad to see it go.
There was a problem hiding this comment.
It is tested to clearly correct
| pacf[0] = 1.0 | ||
| if efficient: | ||
| xlags, x0 = lagmat(x, nlags, original='sep') | ||
| xlags = add_constant(xlags) |
There was a problem hiding this comment.
It took me a minute to figure out why de-meaning on line 701 doesn't affect the outcome. Maybe for the sake of future readers only de-mean in the not-efficient case?
There was a problem hiding this comment.
I figured it just keeps the code simpler, but moved it anyway.
|
|
||
| if method == 'ols': | ||
| ret = pacf_ols(x, nlags=nlags) | ||
| if method.startswith('ols'): |
There was a problem hiding this comment.
Do we want to deny invalid strings starting with "ols"?
|
Couple comments, generally looks quite nice. |
e7624ef to
24edcb0
Compare
24edcb0 to
55aa411
Compare
Codecov Report
@@ Coverage Diff @@
## master #5153 +/- ##
==========================================
+ Coverage 82.03% 82.03% +<.01%
==========================================
Files 588 588
Lines 93062 93094 +32
Branches 10317 10322 +5
==========================================
+ Hits 76345 76372 +27
- Misses 14355 14358 +3
- Partials 2362 2364 +2
Continue to review full report at Codecov.
|
|
question (I didn't compare with #3862) Is the new version close to pacf_yd and pacf_ld? (I read only roughly over the algorithm, old unit tests pass.) |
|
Ran a small MC using a range of AR, MA and ARMA models. Ranks Suggests that this method may be reasonable if bias is the main concern. LD and YW unbiased are no good. |
5985bfe to
34cfa3e
Compare
| ld_ = levinson_durbin(acv, nlags=nlags, isacov=True) | ||
| #print 'ld', ld_ | ||
| ret = ld_[2] | ||
| # inconsistent naming with ywmle |
There was a problem hiding this comment.
add TODO/FIXME to this comment?
| elif method in ('ywm', 'ywmle', 'yw_mle'): | ||
| ret = pacf_yw(x, nlags=nlags, method='mle') | ||
| elif method in ['ld', 'ldu', 'ldunbiase', 'ld_unbiased']: | ||
| elif method in ('ld', 'ldu', 'ldunbiased', 'ld_unbiased'): |
34cfa3e to
0d52dfc
Compare
* For pacf with "method=ols", results differ quite a lot from
"method={yw, ld}" (biased and unbiased setting)
* Demeaning and minor changes in the OLS parameters improves the
result for smaller time series (emprirically evaluated)
* Added "unbiased" parameter for ols
* Added reference in docstring
Add option to use text book estiamtor closes statsmodels#3839 closes statsmodels#3862
Add a recommendation to pacf Small doc clean ups
0d52dfc to
fa49fce
Compare
Rebase #3862 and change to enhancement
Clean up docs for pacf functions
Add option to use through pacf()