[SciPy-User] stats.chisquare issues

Bruce Southey bsouthey at gmail.com
Mon Sep 27 21:42:27 EDT 2010


On Mon, Sep 27, 2010 at 6:39 PM, Gökhan Sever <gokhansever at gmail.com> wrote:
> On Mon, Sep 27, 2010 at 2:41 PM, Bruce Southey <bsouthey at gmail.com> wrote:
>>
>> >>>> stats.chisquare(np.array([4, 1, 3, 1.]),np.array([4, 2, 2, 1.]))
>> > (1.0, 0.80125195690120077)
>> >
>> > Not accepting list is a bug
>>
>> It is not a bug because the docstring says arrays not array-like.
>
> This is interesting. I am too much used to then getting array-like sequences
> converted to np.arrays under the hood when I forget explicitly using
> np.arrays for numpy, scipy and matplotlib libraries.

Actually I think that this is rather typical of the scipy.stats
functions. Some functions use _chk_asarray that can convert array-like
input into arrays.

But enhancement patches to handle array-like inputs or other array
types like masked arrays are very welcome!

>
>>
>> If you are doing something like density estimation then you probably
>> need to select your bins (especially in the tails) more carefully to
>> avoid this from happening.
>
> I was testing chi-square test to see how well my model representing my
> actual observed data. Right know I don't need to use the function for
> further calculation as I have different methods to estimate the quality of
> my fit.
> Thanks for your suggestions.
>
> --
> Gökhan
>

Good as I was just guessing.

Bruce



More information about the SciPy-User mailing list