[Scipy-tickets] [SciPy] #1811: lognorm has parameters in the wrong order compared to norm

SciPy Trac scipy-tickets@scipy....
Fri Jan 11 09:54:21 CST 2013


#1811: lognorm has parameters in the wrong order compared to norm
---------------------+------------------------------------------------------
 Reporter:  rdw      |       Owner:  somebody   
     Type:  defect   |      Status:  new        
 Priority:  normal   |   Milestone:  Unscheduled
Component:  Other    |     Version:  0.11.0     
 Keywords:  lognorm  |  
---------------------+------------------------------------------------------
 If you want to compare norm with lognorm:


 {{{
 from scipy.stats import norm, lognorm
 import numpy as np
 import matplotlib.pyplot as plt
 # example: r(t) = ln(1 + R(t)) ~ N(0.05, (0.5)^2))
 #          1 + R(t) = exp(r(t)) ~ logNormal(0.05, (0.5)^2)
 #          R(t) = e(r(t)) - 1 ~ logNormal(0.05, (0.5)^2) - 1
 #
 # plot normal and log normal density
 mu = .05
 sd = .5
 x = np.linspace(mu - 3 * sd, mu + 3 * sd, 100)
 plt.plot(x, norm.pdf(x, mu, sd), label="Normal")
 plt.plot(exp(x)-1, lognorm.pdf(exp(x), mu, sd), '--', label="Log-Normal")
 }}}

 you see that it does not work and you have to swap loc and scale:

 {{{
 plt.plot(exp(x)-1, lognorm.pdf(exp(x), sd, mu), '--', label="Log-Normal")
 }}}

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


More information about the Scipy-tickets mailing list