[SciPy-dev] plans for stats.py?

Travis Oliphant oliphant.travis at ieee.org
Thu Feb 2 21:05:24 CST 2006


Christopher Fonnesbeck wrote:

> I have been trying to run some basic analyses in scipy.stats, but  
> have had little success. A simple t-test using ttest_ind crashes:
>
> In [3]: ttest_ind([4,5,6,7,3,5,7],[7,9,5,3,4,2,6])
> ------------------------------------------------------------------------ 
> ---
> exceptions.TypeError                                 Traceback (most  
> recent call last)
>
> /Users/chris/<ipython console>
>
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
> packages/scipy-0.4.5.1576-py2.4-macosx-10.4-ppc.egg/scipy/stats/ 
> stats.py in ttest_ind(a=array([4, 5, 6, 7, 3, 5, 7]), b=array([7, 9,  
> 5, 3, 4, 2, 6]), axis=0, printit=False, name1='Samp1', name2='Samp2',  
> writemode='a')
>    1441     if type(t) == ArrayType:
>    1442         probs = reshape(probs,t.shape)
> -> 1443     if len(probs) == 1:
>         global len = undefined
>         probs = 0.89621601307466014
>    1444         probs = probs[0]
>    1445
>
> TypeError: len() of unsized object
>
> I get a similar result with anova.
>
> Are there any plans in place to re-vamp this module? It is very  
> poorly documented -- arguments are not described for many functions,  
> for example. I am willing to begin a revision of this code, but did  
> not want to step on any toes.
>
Don't worry about that.  The stats module desperately needs some 
attention.  Robert will probably  have opinions on some of the 
functions, but most of them are adapted from Gary Stragman's original 
code. 

I suspect there are still "conversion" issues that have not been taken 
care of.  This for example, looks like a problem when probs is a 
scalar.   It should be recoded to probs.size == 1


-Travis




More information about the Scipy-dev mailing list