[Scipy-tickets] [SciPy] #1548: BUG: wrong variance in powerlaw.stats

SciPy Trac scipy-tickets@scipy....
Mon Oct 31 12:16:03 CDT 2011


#1548: BUG: wrong variance in powerlaw.stats
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  somebody   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.9.0      
 Keywords:               |  
-------------------------+--------------------------------------------------
 I don't find any explicit formulas for powerlaw moments.

 powerlaw is a special case of beta. If alpha is 1, then it's the uniform
 distribution on [0,1]

 {{{
 >>> stats.uniform.stats()
 (array(0.5), array(0.08333333333333333))
 >>> stats.beta.cdf(np.linspace(0,1,11),1,1)
 array([ 0. ,  0.1,  0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9,  1. ])
 >>> stats.beta.pdf(np.linspace(0,1,11),1,1)
 array([ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.])
 >>> stats.powerlaw.pdf(np.linspace(0,1,11),1)
 array([ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.])
 >>> stats.powerlaw.cdf(np.linspace(0,1,11),1)
 array([ 0. ,  0.1,  0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9,  1. ])
 >>> stats.beta.stats(1,1)
 (array(0.5), array(0.08333333333333333))
 >>> stats.powerlaw.stats(2)
 (array(0.6666666666666666), array(0.8888888888888888))
 >>> stats.powerlaw.stats(1)
 (array(0.5), array(0.75))
 >>> rvspl = stats.powerlaw.rvs(1, size=1000)
 >>> rvspl.mean()
 0.5144549860144142
 >>> rvspl.var()
 0.078974405485170221
 }}}


 while waiting for the server error to go away I found a `*` instead of a
 `/` in the formula

 {{{
 var = a/(a+2.0)/(a+1.0)**2
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1548>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list