In tukey_hsd.plot_simultaneous - "ones" not defined. #2065

Closed
tshauck opened this Issue Oct 24, 2014 · 2 comments

Projects

None yet

3 participants

@tshauck
Contributor
tshauck commented Oct 24, 2014

I believe the ones should be np.ones.


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-30-234737c8d0af> in <module>()
----> 1 tuk.plot_simultaneous()

/home/thauck/.virtualenvs/zues/local/lib/python2.7/site-packages/statsmodels/sandbox/stats/multicomp.pyc in plot_simultaneous(self, comparison_name, ax, figsize, xlabel, ylabel)
    712             fig.set_size_inches(figsize)
    713         if getattr(self, 'halfwidths', None) is None:
--> 714             self._simultaneous_ci()
    715         means = self._multicomp.groupstats.groupmean
    716 

/home/thauck/.virtualenvs/zues/local/lib/python2.7/site-packages/statsmodels/sandbox/stats/multicomp.pyc in _simultaneous_ci(self)
    640         self.halfwidths = simultaneous_ci(self.q_crit, self.variance,
    641                             self._multicomp.groupstats.groupnobs,
--> 642                             self._multicomp.pairindices)
    643 
    644     def plot_simultaneous(self, comparison_name=None, ax=None, figsize=(10,6),

/home/thauck/.virtualenvs/zues/local/lib/python2.7/site-packages/statsmodels/sandbox/stats/multicomp.pyc in simultaneous_ci(q_crit, var, groupnobs, pairindices)
   1321         w = ((ng-1.) * sum2 - sum1) / ((ng - 1.) * (ng - 2.))
   1322     else:
-> 1323         w = sum1 * ones(2, 1) / 2.
   1324 
   1325     return (q_crit / np.sqrt(2))*w

NameError: global name 'ones' is not defined
>>> sm.version.full_version
'0.5.0'
@josef-pkt
Member

Thanks, it's still there (in my checkout of some branch of recent master)
eclipse/pydev shows another red for undefined variables for the triu option in distance_st_range (which looks like a rewritten helper function that's not used yet).

I don't know if there was much checking for the case when we only have two samples and a single pair in the comparison.

@josef-pkt josef-pkt added this to the 0.6 milestone Oct 24, 2014
@tshauck
Contributor
tshauck commented Oct 25, 2014

I was doing some testing with something on top of statsmodels and wasn't being picky about my inputs.

Anyways, just pushed a change with np. added.

@jseabold jseabold pushed a commit that closed this issue Nov 21, 2014
@tshauck tshauck fixes #2065 0c70d79
@jseabold jseabold closed this in 0c70d79 Nov 21, 2014
@jseabold jseabold modified the milestone: 0.6.1, 0.6 Dec 2, 2014
@jseabold jseabold added a commit that referenced this issue Dec 2, 2014
@jseabold jseabold Backport PR #2066: fixes #2065 (missing np)
Fixes the missing numpy ones.
aa93dda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment