-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
design cannot be n x 1 #53
Comments
[ LP comment 1 by: joep, on 2009-09-22 03:15:13.256575+00:00 ] In a related issue, I am a bit puzzled why class Model defines self.exog as row vector if original exog is 1d class Model I think in GLSAR.init, I used a (n,1) exog when I only have the constant: I guess we need tests to make sure every class works consistently with 1d row or column vectors as exog. Similarly, I'm not sure what the dimension requirements for endog are, 1d or also 2d column vector. |
[ LP comment 2 by: joep, on 2009-09-22 19:15:31.916917+00:00 ] res_regression = sm.OLS(res[1:],res[:1]).fit() here exog has only a single element. It looks like we don't have a check for consistent number of observation in endog and exog.
But it looks like 1d exog fails, |
[ LP comment 3 by: Skipper Seabold, on 2009-09-22 20:54:41.292465+00:00 ] Good catch. That was a typo. Should be res[:,-1] I think (not on a machine where I can test). Part of fixing this "bug" should be adding the checks for shapes. I would like the user to never have to worry about whether the shape is 1d or 2d ie., (N,) vs (N,1). Part of the inconsistency now is from pinv and dot not being able to distinguish between the two (though with good reason in this case). That way, it should be the first test that's written for new models. It's not clear right now how much can be moved up to the parent class wrt your comments on GLSAR. |
[ LP comment 4 by: Skipper Seabold, on 2009-09-28 18:14:41.707427+00:00 ] I have commited a fix for this and added some tests for shapes in regression to test_regression. It currently tests that the outputs are the same for the shapes of (n,1) or (n,) for endog or (n,1) or (n,) for exog. There is also test that endog.shape[0] = exog.shape[0]. Changes are in my branch only at the moment. |
Original Launchpad bug 434407: https://bugs.launchpad.net/statsmodels/+bug/434407
Reported by: jsseabold (Skipper Seabold).
Just so I remember. GLS does not currently work for a n x 1 design array.
import scikits.statsmodels as sm
data = sm.datasets.longley.Load()
data.exog = sm.add_constant(data.exog)
ols_res = sm.OLS(data.endog, data.exog).fit()
res = ols_res.resid
res_regression = sm.OLS(res[1:],res[:1]).fit()
ValueError: matrices are not aligned
The one time I tried to work on this, it took a little more attention than I expected or had time for.
The text was updated successfully, but these errors were encountered: