[SciPy-user] help with scipy.stats.mannwhitneyu

josef.pktd@gmai... josef.pktd@gmai...
Thu Feb 5 12:53:37 CST 2009


On Thu, Feb 5, 2009 at 1:35 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
>
> On Feb 5, 2009, at 1:31 PM, josef.pktd@gmail.com wrote:
>
>>
>> Just calling this, according to docstring, requires sequence, correct
>> usage is not clear:
>>
>>>>> stats.mstats.compare_medians_ms(rvs1,rvs2)
>
> OK, can you send me a test sample (ie, the rvs1& rvs2 you used that
> fail, and what we should have had)? I'll try to fix that this
> afternoon...
>

I generated rvs1 and rvs2 (without fixed seed)

rvs1 = stats.norm.rvs(size = 100)
rvs2 = 0.25*stats.norm.rvs(size = 100)

I didn't look at stats.mstats.compare_medians_ms specifically, but it
sounded like it should do something similar to the other tests I was
trying out. So, I don't know what the expected answer should be, but I
would expect a p-values similar to the other non-parametric tests for
equality of location.

the problem is in stats.mstats_basic.stde_median.
Note: it is not exported  (I'm not sure how or why the imports work)
and can be accessed only directly

>>> stats.mstats.stde_median(rvs1,axis=0)
Traceback (most recent call last):
  File "<pyshell#143>", line 1, in <module>
    stats.mstats.stde_median(rvs1,axis=0)
AttributeError: 'module' object has no attribute 'stde_median'

calling it directly returns this:

>>> stats.mstats_basic.stde_median(rvs1,axis=0)
Traceback (most recent call last):
  File "<pyshell#142>", line 1, in <module>
    stats.mstats_basic.stde_median(rvs1,axis=0)
  File "C:\Programs\Python25\lib\site-packages\scipy\stats\mstats_basic.py",
line 1514, in stde_median
    return ma.apply_along_axis(_stdemed_1D, axis, data)
  File "C:\Programs\Python25\lib\site-packages\numpy\ma\extras.py",
line 185, in apply_along_axis
    res = func1d(arr[tuple(i.tolist())], *args, **kwargs)
  File "C:\Programs\Python25\lib\site-packages\scipy\stats\mstats_basic.py",
line 1504, in _stdemed_1D
    n = len(sorted)
TypeError: object of type 'builtin_function_or_method' has no len()



Josef


More information about the SciPy-user mailing list