[SciPy-dev] Problem with F distribution, or with me? - error in stats.fatiguelife.rvs

josef.pktd@gmai... josef.pktd@gmai...
Wed Aug 13 08:42:59 CDT 2008


It looks like that there is an error in stats.fatiguelife.rvs

Kolmogorov test fails
>>> stats.kstest('fatiguelife','',args=(5,),N=1000)
(0.093216666807115545, array(2.5853082230575808e-008))

Mean of sample

>>> stats.fatiguelife.stats(5,moments='m')
array(13.5)
>>> np.mean(stats.fatiguelife.rvs(5,size=1000))
26.683858360164475
>>> np.mean(stats.fatiguelife.rvs(5,size=10000))
26.841525716395847
>>> np.mean(stats.fatiguelife.rvs(5,size=100000))
26.730694604009678
>>> np.mean(stats.fatiguelife.rvs(5,size=100000)/2)
13.469823793800416

>>> stats.fatiguelife.stats(3,moments='m')
array(5.5)
>>> np.mean(stats.fatiguelife.rvs(3,size=100000))
10.922712537094393
>>> np.mean(stats.fatiguelife.rvs(3,size=100000)/2)
5.5340854278553246

Variance of sample

>>> stats.fatiguelife.stats(3,moments='v')
array(110.25)
>>> np.var(stats.fatiguelife.rvs(3,size=1000000))
440.1793356094052
>>> np.var(stats.fatiguelife.rvs(3,size=1000000)/2)
110.445022957997
>>> np.var(stats.fatiguelife.rvs(3,size=10000000)/2)
110.03364894832275

>>> stats.fatiguelife.stats(5,moments='v')
array(806.25)
>>> np.var(stats.fatiguelife.rvs(5,size=1000000))
3222.4271388000293
>>> np.var(stats.fatiguelife.rvs(5,size=1000000)/2)
809.29193071702855

theoretical mean and cdf  look correct, according to
http://www.itl.nist.gov/div898/handbook/eda/section3/eda366a.htm
but random number generator, is wrong by approximately the scale of 1/2

Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20080813/f4f9631e/attachment-0001.html 


More information about the Scipy-dev mailing list