[SciPy-user] Usage of scipy KS test

Alexander Dietz Alexander.Dietz@astro.cf.ac...
Wed Jan 2 13:44:55 CST 2008


Hi,

thanks a lot for the quick reply, but your suggestion does not seem to work.

On Jan 2, 2008 5:08 PM, Anne Archibald <peridot.faceted@gmail.com> wro
>
>
> This format is more complicated than what we need. scipy.stats.kstest
> wants the list of (not necessarily sorted) x values, and a function
> that evaluates the CDF. The simplest thing to do is provide it your
> function that evaluates the CDF rather than computing m. If, however,
> you have already computed m, you can cheat: scipy.stats.kstest only
> needs to evaluate the function at the points in x, so you can create a
> function based on dictionary lookup:
>
> scipy.stats.kstest(x,dict(zip(x,m)).get)
>
> This should return a tuple containing the KS D value and the
> probability a data set like this one would be obtained from a
> probability distribution with your CDF.
>
>
When I use your suggestion, I get an error:

 File "/usr/lib/python2.4/site-packages/scipy/stats/stats.py", line 1716, in
kstest
    cdfvals = cdf(vals, *args)
TypeError: unhashable type

I tried with get(), but this also did not work.  Also, in this example I do
not see the vector 'm' containing the modeled values. They must enter
somehow the expression....

Assumed, I calculate the D-value by myself. Can I then use stats.ksprob to
calculate the probability? Do I have to use sqrt(n)*D as argument?


Thanks
  Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080102/5656acd6/attachment.html 


More information about the SciPy-user mailing list