Permalink
Browse files

BUG: Check shapes after data processing. Closes #517.

  • Loading branch information...
1 parent 9f37013 commit ec4d0d5b3b67cb4698fc19be1841108f72360d9d @jseabold jseabold committed Oct 8, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 statsmodels/regression/linear_model.py
@@ -372,12 +372,13 @@ def __init__(self, endog, exog, weights=1., missing='none'):
weights = np.array(weights)
if weights.shape == ():
weights = np.repeat(weights, len(endog))
- nobs = exog.shape[0]
- if weights.shape[0] != nobs and weights.size == nobs:
- raise ValueError('Weights must be scalar or same length as design')
- self.weights = weights.squeeze()
+ weights = weights.squeeze()
super(WLS, self).__init__(endog, exog, missing=missing,
- weights=self.weights)
+ weights=weights)
+ nobs = self.exog.shape[0]
+ weights = self.weights
+ if len(weights) != nobs and weights.size == nobs:
+ raise ValueError('Weights must be scalar or same length as design')
def whiten(self, X):
"""

0 comments on commit ec4d0d5

Please sign in to comment.