[SciPy-dev] Problem with F distribution, or with me?

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Aug 13 12:03:46 EDT 2008


I looked some more at genextreme and loggamma distributions. Both seem to be
ok, but only on a restricted domain. Maybe this could be mentioned in the
doc strings.


genextreme: mean and variance of sample
 c        mean            variance
-10.1 2.03183339039e+046 4.10875567714e+097
-9.1 8.73524294338e+046 7.63037062101e+098
-8.1 3.43173786542e+029 3.7041223192e+063
-7.1 2.56715180769e+029 4.83202007123e+063
-6.1 6.38255235148e+025 3.96122540324e+056
-5.1 2.17899531771e+019 2.78413740065e+043
-4.1 2.11131451031e+018 4.45696503066e+041
-3.1 1023550562.61 2.58109364566e+022
-2.1 173604.32446 1.15250794324e+015
-1.1 17.5172037108 348742.573234
-0.1 0.67925866308 2.2049366648
0.9 0.0448402183177 0.929688939344
1.9 -0.413704842079 3.82434734783
2.9 -1.49614654365 58.0798269907
3.9 -5.06385824194 1507.40696605
4.9 -20.0955456516 63494.3016592
5.9 -101.601673556 5611029.51369
6.9 -668.732337727 464527444.003
7.9 -3864.35379097 27915569490.2
8.9 -44833.4387546 2.5781344271e+013
9.9 -156511.731133 5.9148778182e+013
10.9 -4208783.3068 4.1364771468e+017
11.9 -12363752.6511 9.49784745096e+017
12.9 -687931749.834 2.12662176368e+022
13.9 -3564704408.19 1.49396435068e+023
14.9 -55267493180.0 1.75088408867e+026
15.9 -89255193706.2 1.68855387759e+026
16.9 -1.44638018472e+013 1.95168337353e+031
17.9 -2.82021450011e+013 5.28737543263e+031
18.9 -2.70352320915e+014 2.76333229745e+033

genextreme: Kolmogorov test
 c    pval
-10.1 0.0743077659229 fail
-9.1 0.42774246842
-8.1 0.320666171255
-7.1 0.140353007389
-6.1 0.422004148643
-5.1 0.235860485941
-4.1 0.123131615734
-3.1 0.0584578205023 fail
-2.1 0.0806014275316 fail
-1.1 0.551087520596
-0.1 0.443666131702
0.9 0.0897965413418 fail
1.9 0.000687904138691 fail
2.9 0.14533205744
3.9 0.266177157829
4.9 0.248863135101
5.9 0.0525623128538 fail
6.9 0.0189969790597 fail
7.9 1.21972182576e-007 fail
8.9 0.0 fail
9.9 0.0 fail
10.9 0.0 fail
11.9 0.0 fail
12.9 0.0 fail
13.9 0.0 fail
14.9 0.0 fail
15.9 0.0 fail
16.9 0.0 fail
17.9 0.0 fail
18.9 0.0 fail

loggamma: mean and variance of sample
 c        mean            variance
0.1 1.#QNAN 1.#QNAN
0.2 1.#QNAN 1.#QNAN
0.3 1.#QNAN 1.#QNAN
0.4 1.#QNAN 1.#QNAN
0.5 1.#QNAN 1.#QNAN
0.6 1.#QNAN 1.#QNAN
0.7 1.#QNAN 1.#QNAN
0.8 1.#QNAN 1.#QNAN
0.9 1.#QNAN 1.#QNAN
1.0 -0.576668705715 1.63525671992
1.1 -0.525273410576 1.34235414411
1.2 -0.428429138219 1.11702081261
1.3 -0.341788789013 0.974156958424
1.4 -0.241612900595 0.862346072551
1.5 -0.136331803853 0.788179027654
1.6 -0.0313490020812 0.725560746671
1.7 0.0748869989073 0.678337971919
1.8 0.185785501444 0.646038183747
1.9 0.293612948064 0.632854109548
2.0 0.422063781842 0.644406991859
2.1 1.#QNAN 1.#QNAN
2.2 1.#QNAN 1.#QNAN
2.3 1.#QNAN 1.#QNAN
2.4 1.#QNAN 1.#QNAN
2.5 1.#QNAN 1.#QNAN
2.6 1.#QNAN 1.#QNAN
2.7 1.#QNAN 1.#QNAN
2.8 1.#QNAN 1.#QNAN
2.9 1.#QNAN 1.#QNAN
3.0 1.#QNAN 1.#QNAN

loggamma: Kolmogorov test
 c    pval
0.1 0.0 fail
0.2 0.0 fail
0.3 0.0 fail
0.4 0.0 fail
0.5 0.0 fail
0.6 0.0 fail
0.7 0.0 fail
0.8 0.0 fail
0.9 0.0 fail
1.0 0.0944212682068 fail
1.1 0.0721468077268 fail
1.2 0.429110318521
1.3 0.185750416387
1.4 0.12670896322
1.5 0.328821862924
1.6 0.205984847372
1.7 0.283064144052
1.8 0.0290310978597 fail
1.9 0.135995409763
2.0 0.0864826709644 fail
2.1 0.0 fail
2.2 0.0 fail
2.3 0.0 fail
2.4 0.0 fail
2.5 0.0 fail
2.6 0.0 fail
2.7 0.0 fail
2.8 0.0 fail
2.9 0.0 fail
3.0 0.0 fail

This was produced with:

import numpy as np
import scipy.stats as stats


N=100000
#N=1000

print "\ngenextreme: mean and variance of sample"
print ' c        mean            variance'
for i in range(30):
    c = -10.1+i/1.0
    rn = stats.genextreme.rvs(c,size=N)
    print c, np.mean(rn), np.var(rn)

print "\ngenextreme: Kolmogorov test"
print ' c    pval'
for i in range(30):
    c = -10.1+i/1.0
    D, pval = stats.kstest('genextreme','',args=(c,),N=N)
    print c, pval, (pval<0.1 and 'fail' or '')

print "\nloggamma: mean and variance of sample"
print ' c        mean            variance'
for i in range(30):
    c = 0.100+i/10.0
    rn = stats.loggamma.rvs(c,size=N)
    print c, np.mean(rn), np.var(rn)

print "\nloggamma: Kolmogorov test"
print ' c    pval'
for i in range(30):
    c = 0.100+i/10.0
    D, pval = stats.kstest('loggamma','',args=(c,),N=N)
    print c, pval, (pval<0.1 and 'fail' or '')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20080813/86266e54/attachment.html>


More information about the SciPy-Dev mailing list