{"action":"created","issue":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4289","repository_url":"https://api.github.com/repos/statsmodels/statsmodels","labels_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4289/labels{/name}","comments_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4289/comments","events_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4289/events","html_url":"https://github.com/statsmodels/statsmodels/issues/4289","id":301992037,"number":4289,"title":"SARIMAX ar_params/ma_params giving incorrect results for non-consecutive lags","user":{"login":"NowanIlfideme","id":2067093,"avatar_url":"https://avatars1.githubusercontent.com/u/2067093?v=4","gravatar_id":"","url":"https://api.github.com/users/NowanIlfideme","html_url":"https://github.com/NowanIlfideme","followers_url":"https://api.github.com/users/NowanIlfideme/followers","following_url":"https://api.github.com/users/NowanIlfideme/following{/other_user}","gists_url":"https://api.github.com/users/NowanIlfideme/gists{/gist_id}","starred_url":"https://api.github.com/users/NowanIlfideme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NowanIlfideme/subscriptions","organizations_url":"https://api.github.com/users/NowanIlfideme/orgs","repos_url":"https://api.github.com/users/NowanIlfideme/repos","events_url":"https://api.github.com/users/NowanIlfideme/events{/privacy}","received_events_url":"https://api.github.com/users/NowanIlfideme/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-03T11:48:37Z","updated_at":"2018-03-03T17:37:06Z","closed_at":null,"author_association":"NONE","body":"When using non-consecutive lags with SARIMAX, i.e. tuples for p or q, the resultant ar_params and ma_params aren't cut off correctly from all the others. I haven't tested with the combination, or with P/Q, but likely the same happens there.\r\n\r\nstatsmodels full_version == '0.8.0'\r\n\r\nExample below.\r\n\r\n```\r\n>>> import statsmodels.api as sm\r\n>>> import numpy as np\r\n>>> import pandas as pd\r\n>>> dta = sm.datasets.sunspots.load_pandas().data\r\n>>> sss = lambda x : pd.Timestamp(str(int(x)) + \"-01-01\")\r\n>>> dta = dta.set_index(pd.DatetimeIndex(dta[\"YEAR\"].apply(sss)))\r\n>>> del dta['YEAR']\r\n>>> endog = dta['SUNACTIVITY']\r\n>>> order1 = (3,0,0)\r\n>>> mod1 = sm.tsa.SARIMAX(endog, order=order1).fit(disp=0)\r\n>>> order2 = ((1,0,1), 0, 0)\r\n>>> mod2 = sm.tsa.SARIMAX(endog, order=order2).fit(disp=0)\r\n>>> order3 = ((0,0,1), 0, 0)\r\n>>> mod3 = sm.tsa.SARIMAX(endog, order=order3).fit(disp=0)\r\n>>> print(mod1.params)\r\nar.L1       1.559285\r\nar.L2      -0.787745\r\nar.L3       0.130519\r\nsigma2    349.730362\r\ndtype: float64\r\n>>> print(mod2.params)\r\nar.L1       1.148138\r\nar.L3      -0.279352\r\nsigma2    428.185631\r\ndtype: float64\r\n>>> print(mod3.params)\r\nar.L3        0.616523\r\nsigma2    2516.393448\r\ndtype: float64\r\n>>> print(mod1.arparams)\r\n[ 1.55928508 -0.78774548  0.13051884]\r\n>>> print(mod2.arparams)\r\n[  1.14813810e+00  -2.79352080e-01   4.28185631e+02]\r\n>>> print(mod3.arparams)\r\n[  6.16522707e-01   2.51639345e+03]\r\n```\r\n\r\nOff-topic: what is the correct term for this kind of AR process? Just a constrained AR(max_lag)? Partial autoregression?"},"comment":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/comments/370165477","html_url":"https://github.com/statsmodels/statsmodels/issues/4289#issuecomment-370165477","issue_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4289","id":370165477,"user":{"login":"ChadFulton","id":280864,"avatar_url":"https://avatars0.githubusercontent.com/u/280864?v=4","gravatar_id":"","url":"https://api.github.com/users/ChadFulton","html_url":"https://github.com/ChadFulton","followers_url":"https://api.github.com/users/ChadFulton/followers","following_url":"https://api.github.com/users/ChadFulton/following{/other_user}","gists_url":"https://api.github.com/users/ChadFulton/gists{/gist_id}","starred_url":"https://api.github.com/users/ChadFulton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChadFulton/subscriptions","organizations_url":"https://api.github.com/users/ChadFulton/orgs","repos_url":"https://api.github.com/users/ChadFulton/repos","events_url":"https://api.github.com/users/ChadFulton/events{/privacy}","received_events_url":"https://api.github.com/users/ChadFulton/received_events","type":"User","site_admin":false},"created_at":"2018-03-03T17:37:06Z","updated_at":"2018-03-03T17:37:06Z","author_association":"MEMBER","body":"> Another, related issue I ran into just now was the inconsistency of the model.params depending on the input (endog/exog) type: pd.Series if the input was pandas, and np.ndarray if the input was numpy.\r\n\r\n> I understand this might be to allow users without pandas imported to use the objects... but pandas is a requirement for statsmodels, so I don't quite understand why that would be necessary.\r\n\r\nYes I can see what you mean. I think this is the general Statsmodels policy, and it might now be hard to change for backwards compatibility reasons. @josef-pkt am I remembering that right?"}}
{"actor":{"display_login":"ChadFulton"}}