Comments (4)
[ 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
def init(self, endog, exog=None):
self.endog = np.asarray(endog)
self.exog = np.atleast_2d(np.asarray(exog))
I think in GLSAR.init, I used a (n,1) exog when I only have the constant:
if exog is None:
super(GLSAR, self).init(endog, np.ones((endog.shape[0],1)))
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.
from statsmodels.
[ 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.
sm.OLS(res[1:,None], res[:-1,None]).fit().params
array([[-0.36676742]])
sm.OLS(res[1:], res[:-1,None]).fit().params
array([-0.36676742])
sm.OLS(res[1:], res[:-1]).fit().params # 1d exog fails
Traceback (most recent call last):
...
ValueError: matrices are not aligned
But it looks like 1d exog fails,
from statsmodels.
[ 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.
from statsmodels.
[ 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.
from statsmodels.
Related Issues (20)
- ENH/BUG: fixed scale in RLM, float scale_est HOT 3
- bug: 0.14.2 seems to have broken my dependency graph HOT 4
- BUG/DOC: unavailable datasets for docs notebooks
- mixed effects model with nested random effects by statsmodels.formula.api.negativebinomial
- BUG: RLM fit history uses WLS scale and not the robust scale estimate
- ARIMA(1,1,1) model doesn't seem to discard non-differentiated values after differentiation. HOT 3
- ENH: handle dummy and categorical variables in robust methods, e.g. cov, mahalanobis, subsampling
- ENH: roadmap, overview robust HOT 1
- Is the implementation of the clopper-pearson upperbound correct? HOT 1
- DOC: Some function links in 'Regression diagnostics' are broken HOT 3
- How to get in touch regarding a security concern HOT 4
- BUG: RLM fit with start_params raises if only one parameter
- Tweedie loglikelihood returning inf for some values and impacting constrained optimization. Related to use of scipy's wrigh_bessel function in computing likelihood. HOT 8
- Failed to install on android HOT 10
- bug:too many indices for array: array is 0-dimensional, but 1 were indexed
- stats/proportion.py's binom_test_reject_interval function's error HOT 2
- ENH: proportion_confint only has two-sided confidence intervals, no "alternative" option HOT 3
- ENH: robust default start_params in M-estimators, RLM, and CovM ?
- ENH: maybe, S- and M-estimator for multivariate mean, scatter for large k_vars HOT 3
- ENH: pseudo-determinant, matrix determinant for singular cov, mahalanobis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsmodels.