{"action":"created","issue":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/3628","repository_url":"https://api.github.com/repos/statsmodels/statsmodels","labels_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/3628/labels{/name}","comments_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/3628/comments","events_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/3628/events","html_url":"https://github.com/statsmodels/statsmodels/issues/3628","id":224924506,"number":3628,"title":"varmax transform_params inconsistency?","user":{"login":"jbrockmendel","id":8078968,"avatar_url":"https://avatars2.githubusercontent.com/u/8078968?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrockmendel","html_url":"https://github.com/jbrockmendel","followers_url":"https://api.github.com/users/jbrockmendel/followers","following_url":"https://api.github.com/users/jbrockmendel/following{/other_user}","gists_url":"https://api.github.com/users/jbrockmendel/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrockmendel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrockmendel/subscriptions","organizations_url":"https://api.github.com/users/jbrockmendel/orgs","repos_url":"https://api.github.com/users/jbrockmendel/repos","events_url":"https://api.github.com/users/jbrockmendel/events{/privacy}","received_events_url":"https://api.github.com/users/jbrockmendel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-27T21:55:58Z","updated_at":"2017-04-28T22:06:46Z","closed_at":null,"body":"@ChadFulton \r\nIf you say this is intentional I'll take your word for it, but this still stands out to me:\r\nhttps://github.com/statsmodels/statsmodels/blob/master/statsmodels/tsa/statespace/varmax.py#L500\r\n\r\n```\r\ndef transform_params(self, unconstrained):\r\n[...]\r\n            if self.error_cov_type == 'diagonal':\r\n                state_cov = np.diag(unconstrained[self._params_state_cov]**2)\r\n\r\n[...]\r\ndef untransform_params(self, constrained):\r\n[...]\r\n            if self.error_cov_type == 'diagonal':\r\n                state_cov = np.diag(constrained[self._params_state_cov])\r\n```\r\n\r\nIs there a `**0.5` missing in the last line?  AFAICT this is the _only_ place in `statespace` where the exponents aren't paired.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/comments/298117641","html_url":"https://github.com/statsmodels/statsmodels/issues/3628#issuecomment-298117641","issue_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/3628","id":298117641,"user":{"login":"jbrockmendel","id":8078968,"avatar_url":"https://avatars2.githubusercontent.com/u/8078968?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrockmendel","html_url":"https://github.com/jbrockmendel","followers_url":"https://api.github.com/users/jbrockmendel/followers","following_url":"https://api.github.com/users/jbrockmendel/following{/other_user}","gists_url":"https://api.github.com/users/jbrockmendel/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrockmendel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrockmendel/subscriptions","organizations_url":"https://api.github.com/users/jbrockmendel/orgs","repos_url":"https://api.github.com/users/jbrockmendel/repos","events_url":"https://api.github.com/users/jbrockmendel/events{/privacy}","received_events_url":"https://api.github.com/users/jbrockmendel/received_events","type":"User","site_admin":false},"created_at":"2017-04-28T22:06:46Z","updated_at":"2017-04-28T22:06:46Z","body":"AFAICT those are unrelated.  When I add in the missing exponent, the test failures are ones that are comparing with stata-based results.  Is there any chance those results are the problem?\r\n\r\nTracking down this particular warning raises errors in 2 varmax tests and 2 dynamic_factor tests.  More specifically, changing\r\n\r\n```\r\nreturn np.sqrt(np.diag(self.cov_params()))\r\n```\r\nto\r\n```\r\ncparams = self.cov_params()\r\ndiag_cov = np.diag(cparams)\r\nassert (diag_cov >= 0).all()\r\nreturn np.sqrt(diag_cov)\r\n```\r\n\r\n```\r\nFAIL: statsmodels.tsa.statespace.tests.test_dynamic_factor.TestDynamicFactor2.test_results\r\n    assert (diag_cov >= 0).all(), diag_cov\r\nAssertionError: [  2.23246140e-05   2.40279921e-05  -1.14575012e-05  -1.00127546e-05\r\n  -9.64319746e-06  -7.83131627e-06   1.79501216e-07   7.76689746e-09\r\n  -1.34475704e-08  -2.23656254e+00  -2.00694714e+00  -2.28831986e+00\r\n  -2.16525980e+00]\r\n[...]\r\nFAIL: statsmodels.tsa.statespace.tests.test_dynamic_factor.TestDynamicFactor2.test_summary\r\n    assert (diag_cov >= 0).all(), diag_cov\r\nAssertionError: [  2.23246140e-05   2.40279921e-05  -1.14575012e-05  -1.00127546e-05\r\n  -9.64319746e-06  -7.83131627e-06   1.79501216e-07   7.76689746e-09\r\n  -1.34475704e-08  -2.23656254e+00  -2.00694714e+00  -2.28831986e+00\r\n  -2.16525980e+00]\r\n[...]\r\nFAIL: statsmodels.tsa.statespace.tests.test_varmax.TestVAR_measurement_error.test_results\r\n    assert (diag_cov >= 0).all(), diag_cov\r\nAssertionError: [  2.20081462e-02   1.80961451e-01   2.19148865e-01   1.41132190e-03\r\n   9.94314362e-03   1.42413666e-02   1.19587470e-03   6.54400257e-03\r\n   5.29922135e-03   2.14631056e-06  -1.10399957e-09  -1.10472660e-09\r\n   2.06773077e-06  -3.04912391e-10  -1.96864638e-10]\r\n[...]\r\nFAIL: statsmodels.tsa.statespace.tests.test_varmax.TestVAR_measurement_error.test_summary\r\n    assert (diag_cov >= 0).all(), diag_cov\r\nAssertionError: [  2.20081462e-02   1.80961451e-01   2.19148865e-01   1.41132190e-03\r\n   9.94314362e-03   1.42413666e-02   1.19587470e-03   6.54400257e-03\r\n   5.29922135e-03   2.14631056e-06  -1.10399957e-09  -1.10472660e-09\r\n   2.06773077e-06  -3.04912391e-10  -1.96864638e-10]\r\n```\r\n\r\nThe varmax cases could plausibly be floating point error.  The dynamic_factor cases are more surprising."}}
{"actor":{"display_login":"jbrockmendel"}}