Skip to content

Arima longar start params - #2550

Closed
chelleych wants to merge 12 commits into
statsmodels:masterfrom
chelleych:arima_longar_start_params
Closed

chelleych wants to merge 12 commits into
statsmodels:masterfrom
chelleych:arima_longar_start_params

Conversation

@chelleych

Copy link
Copy Markdown
Contributor

In response to #2521 and #1301

Allows start_params to be estimated in a method similar to Hannan-Rissanen, but fits initial AR according to user input longar_maxlag instead of best BIC.

Perhaps there should be an additional requirement for longar_maxlag to be at least as long as p. For my data, setting longar_maxlag < p always resulted in nonstationary start_params.

@josef-pkt

Copy link
Copy Markdown
Member

I think the default should not be BIC anymore, but something that is supposed to work.

Based on the references, I think maxlag = max(p, q) + 1 should be a good default.
(and maybe allow string 'aic', 'bic' for the future when we have a minimum lag in the min ic search)

I don't like the name longar_maxlag because it's not clear that it's just for starting values.
I would suggest something like start_arlags, start_ar_lags or longer start_ar_klags
start_arlags would also be appropriate if the method is BIC subject to maxlag > max(p, q)., i.e. start_arlags='bic' or start_arlags=('bic', maxlag) or similar.

Comment thread statsmodels/tsa/arima_model.py Outdated

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.

I guess the new argument should go at the end (before **kwargs). Conceptually it's like an optimizer kwarg.
Also in the front it is too distracting and the user shouldn't have to worry about it under "normal" circumstances.

@chelleych

Copy link
Copy Markdown
Contributor Author

@josef-pkt Any ideas why this build failed some checks? It passed all of them before, but all I changed was the name of the parameter longar_maxlag and some checks started failing.

Thanks in advance!

@josef-pkt

Copy link
Copy Markdown
Member

It's completely unrelated to current PRs, Something changed. The failing version is the one that automatically uses the latest version of our dependencies with python 2.7, and something must have changed with, most likely, the conda packages that started to cause these failures. Those tests passed before, but we don't know yet why they fail now.

@josef-pkt

Copy link
Copy Markdown
Member

@chelleych Can you rebase and squash the commits? then I merge as is.

This adds the option and is backwards compatibility, and we can leave improving and breaking backwards compatibility of default values to another PR.

bashtage pushed a commit to bashtage/statsmodels that referenced this pull request Jun 28, 2016
Added ability to use the long AR method in fitting ARIMA start_params
Improved tests. Fixed case where longar_maxlag is greater than length of
series
Changed longar_start_params variable name to start_ar_lags

closes statsmodels#2550
bashtage pushed a commit to bashtage/statsmodels that referenced this pull request Jul 4, 2016
Added ability to use the long AR method in fitting ARIMA start_params
Improved tests. Fixed case where longar_maxlag is greater than length of
series
Changed longar_start_params variable name to start_ar_lags

closes statsmodels#2550
lbybee added a commit to lbybee/statsmodels that referenced this pull request Jan 27, 2017
add WLS support

move data_generator to fit and add init_kwds_generator (for WLS and GLS)

update notebook to reflect changes to DistributedModel and fit

flake8 check

minor formatting/doc edits

add partition tests

minor mistake

clean assertion

clean partition tests

update tests and fix flake8

update test doc strings and force rebuild

redo test comments for clarity

fix pep8

DOC: Update PyPI classifiers

Update PyPI classifiers
Update PyPI website
Update Minimum version in setup dict

ENH: Add new method to generate starting params

Added ability to use the long AR method in fitting ARIMA start_params
Improved tests. Fixed case where longar_maxlag is greater than length of
series
Changed longar_start_params variable name to start_ar_lags

closes statsmodels#2550

DOC: Add correct types to disp

Add correct type to disp

CLN: Restore incorrect rebase

Remove redundant lines that entered on rebase

Initial commit

Shortcut if nothing to do

exog.columns (typo)

fix typo cols->drop_cols

Fix argument matching in genmod from_formula

Add note indicating limits of drop_cols

Add missing methods to README

DOC: Replace sourceforce with new site

Replace statsmodels.sourceforge.net with www.statsmodels.org

[skip ci]

DOC: Fix Jarque-Bera documentation

Improve Jarque-Bera documentation

closes statsmodels#1579

[skip ci]

BUG: Non-integer index array created from np.r_[ ]

TST/FIX/CLN: Add missing tests smoke for plotting functions

Add missing tests for plotting functions
Fix small bugs in plotting functions
Refactor factorplots to remove bad practices

BUG: SARIMAX get_prediction/get_forecast with exog

BUG: SS: get_prediction/get_forecast with exog

BUG: exog handing in start_params if data missing

CLEAN: PEP8

REF: Use get_forecast from parent class.

BUG: exog handing in start_params if data missing

BUG: Attach dates squeezes too much if predict
length is 1 and k_endog > 1.

TST: Add missing exog tests.

Key defined twice

Removed

TST: fix test_brentq_expanding for scipy 0.8.0

TST: SVAR normalize sign of standard deviation, see statsmodels#3148

TST miscmodel.TLinearModel adjust test precision for scipy 0.8.8

DOC: Fix adfuller docs and _autolag docs

Correct errors in docstrings

[skip ci]

BUG: t_test fix alpha in summary column header closes statsmodels#3116

BUG graphics influence plot, switched criterion closes statsmodels#3103

TST: influence_plot skip test with warning if incompatible matplotlib

TST test_regressionplots close all plots immediately (removes my segfault)

TST test graphics add close('all') (no more segfaults for me)

TST test_var add close('all') to irf cirf plot tests

TST stats test_power close plots

MAINT/TST: test_x13 resample pandas 0.18 compatibility closes statsmodels#3159

BUG: base.Results.predict, handle nan index with formula, closes statsmodels#3087

TST: old pandas compatibility assert_index_equal missing

EHN: implement Sison-Glaz method for multinomial_proportion_confint

This includes tests. There are a number of todos added here and there,
and in the documentation, corresponding to what comes next (Goodman
method and advice on what to use when).

DOCS: explain where the multinomial CI tests come from

TST: add missing test from Sison & Glaz paper

Also define precision for the tests in the results file, and do some
code style fixes.

DOCS: cleanup before a real pass on method advice

EHN: implement goodman method for multinomial CIs

This includes tests.

REF: refactor to fix function name

FIX: integer division don't behave the same under py2 and py3

DOC: reduce 'TODO' ambitions a little

The Hou-Chiang-Tai method would be interesting to implement, but would
take a lot more time.

DOC: fill docstring for multinomial_proportions_confint

FIX: assert_raises_regex is not available in numpy < 1.9

FIX: allow null values in `counts`

DOC: Formatting, and include multinomial_confint docstring in docs

DOC: formatting and phrasing

BUG: str.format() does not exist in python < 2.7

DOC: formatting

DOC: a few more details and coming closer to conventions

STY: variable names and performance

* Don't use `l`, which can be mixed up with `1`
* Use exp sum log instead of product division
* Use `np.minimum` and `np.maximum`

EHN: update method name matching and checks on `counts`

In particular, counts can't have 0-valued entries, as the behavior is
undefined in that case.

DOC: clarify details of the sison-glaz method

BUG/ENH: multinomial_proportions_confint, allow decimals, zeros, speedup

MAINT: try hack for scipy <= 0.16

ENH: cov_type hac_panel allow groups instead of time closes statsmodels#3155

ENH: make cov_type case insensitive

REF: hac-panel, hac_groupsum, avoid np.diff for group identification

MAINT: Remove old pandas compat code.

CLN: Remove old pandas code

Remove old pandas code
Remove unused imports
Reorder imports
Fix issues related to switch to to_datetime

TST: Add test for PD hessian

Add test for PD hessian
Raise if not PD before inversion

closes statsmodels#3098
closes statsmodels#3094

REF: Remove try, except in Hessian inversion

Remove try, except in hessian inversion
Add custom warning type for hessian inversion
Add check for finite elements before computing eigenvalues

BUG: fix GLM resid_working closes statsmodels#2891 adjust tests

Initial commit

Further einsum implementation

add test

Add to tests

BUG: fix binary pred_table for zeros see statsmodels#2968

ENH/BUG: add correct augmented Engle Granger cointegration test

TST add unit tests for coint

TST: `test_coint` add regression test for 'nc' case

Cleaned up some pep8 errors and fixes statsmodels#3167 but doesn't break existing configurations.

changed to check unambiguous first part of the string

Removed extra spacing

TST: Add failing test for summary when tests fail

BUG: Allow summary() even if diagnostic tests fail

TST: Improve smoke test for failing summary tests

ENH: Remove all data arrays in remove_data

TST: Test save, load functionality in Statespace

REF: Special case for creating DatetimeIndex for
nanosecond frequency.

TST: Add tests for Pandas endog with integer index

BUG: Fix shim with pandas 0.13 or Numpy < 1.7

TST: Fix test due to changes from statsmodels#3083.

BUG: Fix possible period / timestamp comparison.

BUG: NotImplemented for nanosecond, Pandas < 0.14

TST: Improve test for Pandas < 0.14

REF: More robust version checking.

REF: Use distutils LooseVersion for comparison

REF: Separate function for individual Hamilton
filter iteration.

REF: More descriptive variable names.

ENH: Cython Kim smoother.

REF: Separate function for individual Kim smoother
iteration.

TST: Add test coverage for py_kim_smoother.

DOC enhance misleading error message

ENH: uniform shebangs in executable .py, and no executable images and tables

fix small typo in error message

Probably this one was the original intended wording

ENH: Add new filter, smoother, simulation smoother

TST: Expanded tests for new filter/smoother modes

BLD/COMPAT: State space with older scipy versions

BUG: Simulation of series via simulation smoother

TST: Default filter method is FILTER_CONVENTIONAL

BUG: Initial state covariance in complex step case

BUG: Incorrect dimension used in collapsed case

TST: Reduce precision for portable test passing

REF: Remove obsolete code.

REF: Driver selection now per-instance, not global

BUG: Univariate smoothed measurement disturbance
and covariance due to typo in Durbin and Koopman
(2012)

TST: Confirm tests for missing case state
disturbance smoother.

ENH: New smooth methods, smoothed autocovariance

ENH: Add cython LDL’ decomposition

BUG: Fix univariate method with general obs cov

BUG: Fix classical smoothing

BUG: Univariate transform failed in edge case: collapse when k_endog = k_states

BUG: Collapsed approach when first obs is partially missing such that the dimension is less than the number of states.

ENH/BUG/TST: Smoothed lag-one autocovariances.

REF: Expose more smoothing variables in results.

ENH: Starting parameters in VARMAX with nan obs

BUG: Wrong check for smoother state autocovariance

BUG: Zeroing out arrays required if multiple runs

BUG: Incorrect set tmp1 array.

BUG: Complex filtered_state_cov calculation.

BUG: Zeroing out arrays required if multiple runs

TST: Add failing tests for models with intercepts

BUG: Fix intercepts in partial missing case

BUG: wrong simulated_state dimensions (segfault)

BUG: Wrong initial state & covariance dimensions

DOC: Document simulation smoother outputs.

ENH: transformed variates as simsmoother output

DOC: + Cython simulation smoother inline comments

BUG: Update the representation in _predict results

BUG: Wrong offsets for unconditional state disturbance.

ENH: Add reordering functions for missing data

REF: “unconditional” -> “generated”

REF: Use lower cholesky decomp., not upper.

BUG: Re-order measurement component if missing

TST: Add good simulation smoother tests, remove
obsolete old tests.

ENH: Python interface to Cython reorder functions

ENH: Add ?swap to blas_lapack.pxd

ENH: Add reorder functions in compatibility mode.

REF: In reorder functions, allow specifying prefix

CLEAN: PEP8 fixes.

REF: Reorder Kalman filter output if missing.

ENH: Add Cython copy function with missing data

ENH: Add Cython copy function for arbitrary index

BUG: Save reordered arrays as numpy arrays.

REF: Reorder Kalman smoother output with Cython

TST: Added collapsed simulation smoothing tests

BUG: Set default smooth method to conventional.

TST: Misc. simulation smoothing coverage.

BUG: Python smoother already re-orders smoothed
measurement disturbances and covariances.

TST: Skip tests of advanced methods in compat mode

TST: Skip tests of autocov in compat mode

TST: Improve mlemodel coverage.

BUG: Revert default smooth_method back to 0,
allow either 0 or 1 in compatibility mode.

TST: Add general obs cov results and replication

COMPAT: Don’t use interpolate if Pandas < 0.12

TST: Reduce test precision.

BUG: Need k_endog > k_states if filter_collapsed

TST: Smoothing tests now actually collapse obs

REF: Remove Cython profiling.

ENH: Std. forecast error: add Cython computation:

DOC/BUG: Statespace custom model documentation

DOC: Fix unobserved components seasonal docstring

TST: Failing SARIMAX test with integer inputs.

BUG: Fix SARIMAX start_params with integer inputs

TST: Initial tests for simulate.

REF: Allow explicit specification: time_invariant

BUG: Variates in 1-dim case squeezed to 0-dim.

BUG: Subsequent simulations with fewer nobs

ENH: Explicit time_invariant for DFM, UC, VARMAX

TST: More comprehensive tests for simulate.

BUG: Zero prepended to IRF in time-varying case

TST: Add tests for state space IRFs

BUG: Output shape of simulate, impulse_responses

fix typos in comments and docstrings

COMPAT: UTF-8 dash to ASCII

fix two typos in the documentation

ENH: Improved date handling.

COMPAT: long in datetools

BUG: Only infer if `freqstr` not set.

BUG: DatetimeIndex can’t parse Q1, M1 synax

BUG: freqstr not defined if freq not defined

BUG: Didn’t re-raise if loc not in row_labels.

BUG: Py3 integer checking if possibly Numpy

BUG: Possibly invalid compare w/ increment index

BUG: Invalid compare w/ increment numpy array

ENH: Improve tsa index handling / validation.

BUG: Only compare freqs if `freq` is not None

REF: Clarify warning language.

BUG: Reset row_labels if k_diff > 0 in ARIMA

REF: Method to get loc from index *or* row labels

BUG: Index coercion failed if `dates` is pd.Series

REF: Improve dates initialization / handling.

DOC: Add note PeriodIndex coercion

BUG: Warning should be issued if dates w/o freq

TST: TSA model is more strict about freq matching

TST: Add tests for new date init, prediction

REF/DOC: Move _get_index_loc, improve docstrings.

BUG: Did not extend all relevant increment indexes

ENH: Make KeyError more informative.

TST/COMPAT: Early Pandas Period with mult. freqs.

COMPAT: Pandas deprecation is_numeric_dtype

BUG/COMPAT: Index comparison in newer Pandas

COMPAT: Workaround pd.to_datetime in older pandas

TST: Fix freq tests.

ENH/TST: Nanosecond support / tests

BUG: Incorrect freq comparison.

BUG: Key not always in created index.

ENH: Support for inferred freq, float indexes

BUG: Incorrect raise statement.

REF: Cleanup.

BUG: Nanosecond check needs to be earlier.

CLEAN: Remove print statements.

BUG: Also check index.freq for nanosecond case.

BUG: Check that index is not None

BUG: Check that index.freq is not None

COMPAT: early Pandas is_numeric_dtype workaround

ENH/TST: Expanded support for custom indexes.

ENH: Add `silent` option to get predict. index

ENH: New warning if numpy data and index given

TST: (Failing) test for sim. smoothing w/ obs int.

BUG: Correctly handle observation intercept.

BUG: MNLogit margins fix summary and summary_frame, closes statsmodels#3309

Fix false convergence cycle warning

Print convergence cycle warning only if convergence cycle was really detected, not every 100 iters

DOC: fix small typo in about.rst

Add MANOVA, CanCorr, _MultivariateOLS and the associated results class

Simplified commit

MAINT: test_anova.py fails on pandas 0.19.0 because stringio closes after read_table. Make read_table global to fix.

MAINT/REF: use integer division in NominalGEEResults see statsmodels#3332

TST/COMPAT: Compatibility with newer Pandas

BUG: Make sure int is passed to pandas date index

Warn if data columns are not object type

Initial commit

Perf improvement for linear models

Add tests

pep-8 edits only

privatize fit_ridge

Docstring fix

TST: Modify forecast test to include seasonal

BUG: Incorrect init kwds for seasonal, AR

Replade pd.TimeSeries to Series

ENH: entry times for Kaplan-Meier

Add entry times for logrank testing

Docstring work

GLM link/family misc numerical improvements

TST: Add test for ARIMA(0,0,0) case

BUG: Fix SARIMAX setup in ARIMA(0,0,0) case

TST: Expanded tests

TST: Fix singular forecast error cov error in test

TST/COMPAT: Only univariate filter if available.

TST: MarkovAutoregression test with Pandas data

BUG: Fix pandas indexes for MarkovAutoregression
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.

2 participants