How do I get a lognormal distribution in Python with Mu and Sigma?

后端 未结 6 673
-上瘾入骨i
-上瘾入骨i 2020-12-23 10:45

I have been trying to get the result of a lognormal distribution using Scipy. I already have the Mu and Sigma, so I don\'t need to do any other prep work. If I need to be

6条回答
  •  感动是毒
    2020-12-23 10:58

    It sounds like you want to instantiate a "frozen" distribution from known parameters. In your example, you could do something like:

    from scipy.stats import lognorm
    stddev = 0.859455801705594
    mean = 0.418749176686875
    dist=lognorm([stddev],loc=mean)
    

    which will give you a lognorm distribution object with the mean and standard deviation you specify. You can then get the pdf or cdf like this:

    import numpy as np
    import pylab as pl
    x=np.linspace(0,6,200)
    pl.plot(x,dist.pdf(x))
    pl.plot(x,dist.cdf(x))
    

    lognorm cdf and pdf

    Is this what you had in mind?

提交回复
热议问题