{"action":"created","issue":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4341","repository_url":"https://api.github.com/repos/statsmodels/statsmodels","labels_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4341/labels{/name}","comments_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4341/comments","events_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4341/events","html_url":"https://github.com/statsmodels/statsmodels/issues/4341","id":305369349,"number":4341,"title":"baseline estimation with QuantRegression","user":{"login":"njbernstein","id":6864886,"avatar_url":"https://avatars2.githubusercontent.com/u/6864886?v=4","gravatar_id":"","url":"https://api.github.com/users/njbernstein","html_url":"https://github.com/njbernstein","followers_url":"https://api.github.com/users/njbernstein/followers","following_url":"https://api.github.com/users/njbernstein/following{/other_user}","gists_url":"https://api.github.com/users/njbernstein/gists{/gist_id}","starred_url":"https://api.github.com/users/njbernstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njbernstein/subscriptions","organizations_url":"https://api.github.com/users/njbernstein/orgs","repos_url":"https://api.github.com/users/njbernstein/repos","events_url":"https://api.github.com/users/njbernstein/events{/privacy}","received_events_url":"https://api.github.com/users/njbernstein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-14T23:55:22Z","updated_at":"2018-03-15T21:10:35Z","closed_at":null,"author_association":"NONE","body":"I'm trying to implement the following \r\n![image](https://user-images.githubusercontent.com/6864886/37435564-0d1c0998-27a1-11e8-81fd-e127d2dc5456.png) from [this paper](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3064906/) in python. \r\n\r\n```\r\nx = some_list #12000 measurements or so\r\nplace_holder = range(0,len(x))\r\ndata = {'x' : x, 'place_holder' : place_holder}\r\ndf = pd.DataFrame(data=data)\r\nmod = smf.quantreg(formula, df)\r\nres = mod.fit(q=quantile)\r\n```\r\n\r\nI run it with the following formulas and get the following aic values out:\r\n```\r\nformula: x ~ place_holder \r\naic: 394623.170417\r\nformula: x ~ place_holder  + I(place_holder ** 2)\r\naic: 394427.966987\r\n\r\n```\r\nand then get this error:\r\n```\r\nformula: x ~ place_holder  + I(place_holder ** 2) + I(place_holder ** 3)\r\n\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-118-cf144633801a> in <module>()\r\n     81 \r\n     82     return output\r\n---> 83 c = quantile_reg_baseline_estimation(a.sample_data, 20, .1)\r\n     84 #d = quantile_reg_baseline_estimation(a.sample_data - c, 20, .1)\r\n\r\n<ipython-input-118-cf144633801a> in quantile_reg_baseline_estimation(x, possible_degrees_of_freedom, quantile)\r\n     66         mod = smf.quantreg(formula, df)\r\n     67         #mod = smf.quantreg('dens ~ temp + I(temp ** 2.0)', df)\r\n---> 68         res = mod.fit(q=quantile)\r\n     69         models.append(res)\r\n     70         res.llf = loglike(res, res.params, mod.endog, mod.exog, scale=None)\r\n\r\n/locus/home/nbernstein/main/locus-pipe/ve/lib/python2.7/site-packages/statsmodels/regression/quantile_regression.pyc in fit(self, q, vcov, kernel, bandwidth, max_iter, p_tol, **kwargs)\r\n    177             resid = np.abs(resid)\r\n    178             xstar = exog / resid[:, np.newaxis]\r\n--> 179             diff = np.max(np.abs(beta - beta0))\r\n    180             history['params'].append(beta)\r\n    181             history['mse'].append(np.mean(resid*resid))\r\n\r\nValueError: operands could not be broadcast together with shapes (4,) (3,) \r\n    \r\n```\r\nWhen I try formulas for cubics and above.\r\n\r\nI'm sure this error is due to the rank of my matrix being less than the actual shape of my matrix, but this is expected. I'm wondering if a pull request to change the starting beta to the shape of the input matrix would be reasonable, or how I might fix my issue otherwise? "},"comment":{"url":"https://api.github.com/repos/statsmodels/statsmodels/issues/comments/373524000","html_url":"https://github.com/statsmodels/statsmodels/issues/4341#issuecomment-373524000","issue_url":"https://api.github.com/repos/statsmodels/statsmodels/issues/4341","id":373524000,"user":{"login":"njbernstein","id":6864886,"avatar_url":"https://avatars2.githubusercontent.com/u/6864886?v=4","gravatar_id":"","url":"https://api.github.com/users/njbernstein","html_url":"https://github.com/njbernstein","followers_url":"https://api.github.com/users/njbernstein/followers","following_url":"https://api.github.com/users/njbernstein/following{/other_user}","gists_url":"https://api.github.com/users/njbernstein/gists{/gist_id}","starred_url":"https://api.github.com/users/njbernstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njbernstein/subscriptions","organizations_url":"https://api.github.com/users/njbernstein/orgs","repos_url":"https://api.github.com/users/njbernstein/repos","events_url":"https://api.github.com/users/njbernstein/events{/privacy}","received_events_url":"https://api.github.com/users/njbernstein/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T21:10:35Z","updated_at":"2018-03-15T21:10:35Z","author_association":"NONE","body":"I tried using a zscore based on this https://stats.stackexchange.com/questions/35071/what-is-rank-deficiency-and-how-to-deal-with-it\r\n\r\nLed to the same issue though"}}
{"actor":{"display_login":"njbernstein"}}