Scipy: lognormal fitting

后端 未结 5 2044
渐次进展
渐次进展 2020-12-25 14:39

There have been quite a few posts on handling the lognorm distribution with Scipy but i still dont get the hang of it.

The 2 parameter lognormal is usua

5条回答
  •  轮回少年
    2020-12-25 15:12

    If you are just interested in plotting you can use seaborn to get a lognormal distribution.

    import seaborn as sns
    import numpy as np
    from scipy import stats
    
    mu=0
    sigma=1
    n=1000
    
    x=np.random.normal(mu,sigma,n)
    sns.distplot(x, fit=stats.norm) # normal distribution
    
    loc=0
    scale=1
    
    x=np.log(np.random.lognormal(loc,scale,n))
    sns.distplot(x, fit=stats.lognorm) # log normal distribution
    

提交回复
热议问题