Skip to content

REF: SARIMAX: only warn for non stationary starting params - #4739

Merged
ChadFulton merged 1 commit into
statsmodels:masterfrom
ChadFulton:sarimax-startparams
Jun 13, 2018
Merged

ChadFulton merged 1 commit into
statsmodels:masterfrom
ChadFulton:sarimax-startparams

Conversation

@ChadFulton

Copy link
Copy Markdown
Member

Previously, if non-stationary (or non-invertible) starting parameters were found (e.g. computed via least squares on lags), the start_params computation raised an exception. This seems unnecessary, so this PR replaces it with a warning, and sets the starting parameters for the non-stationary or non-invertible components to zero.

Example:

mod = sm.tsa.SARIMAX(dta['cpi'], order=(1, 0, 0))
res = mod.fit()
print(res.params[0])
print(res.summary())

yields a:

/Users/fulton/projects/statsmodels/statsmodels/tsa/statespace/sarimax.py:914:
UserWarning: Non-stationary starting autoregressive parameters found. Using zeros as starting parameters.
  warn('Non-stationary starting autoregressive parameters'

and returns output suggesting as close to a non-stationary model as the parameter transformations will allow:

0.9999651762842519

                          Statespace Model Results                           
==============================================================================
Dep. Variable:                    cpi   No. Observations:                  203
Model:               SARIMAX(1, 0, 0)   Log Likelihood                -343.960
Date:                Tue, 12 Jun 2018   AIC                            691.920
Time:                        20:47:28   BIC                            698.546
Sample:                    03-31-1959   HQIC                           694.600
                         - 09-30-2009                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
ar.L1          1.0000   7.19e-05   1.39e+04      0.000       1.000       1.000
sigma2         1.6549      0.131     12.660      0.000       1.399       1.911
===================================================================================
Ljung-Box (Q):                      194.80   Jarque-Bera (JB):               748.38
Prob(Q):                              0.00   Prob(JB):                         0.00
Heteroskedasticity (H):               8.29   Skew:                            -0.45
Prob(H) (two-sided):                  0.00   Kurtosis:                        12.36
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

@josef-pkt

Copy link
Copy Markdown
Member

Sounds good to me.

@coveralls

coveralls commented Jun 13, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.007%) to 83.426% when pulling d03474d on ChadFulton:sarimax-startparams into 3c2ea25 on statsmodels:master.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #4739 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4739      +/-   ##
=========================================
- Coverage   80.91%   80.9%   -0.01%     
=========================================
  Files         577     577              
  Lines       88548   88552       +4     
  Branches     9879    9879              
=========================================
- Hits        71647   71642       -5     
- Misses      14643   14650       +7     
- Partials     2258    2260       +2
Impacted Files Coverage Δ
statsmodels/tsa/statespace/sarimax.py 93.4% <0%> (-0.51%) ⬇️
statsmodels/tsa/stattools.py 82.65% <0%> (-1.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c2ea25...d03474d. Read the comment docs.

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.

4 participants