lognorm方法的参数容易把人搞蒙。例如lognorm.rvs(s, loc=0, scale=1, size=1)中的参数s,loc,scale, 要记住:loc和scale并不是我们通常理解的对数变化后数据的均值mu和标准差sigma,如下面所述:

The probability density function for lognorm is:

lognorm.pdf(x, s) = 1 / (s*x*sqrt(2*pi)) * exp(-1/2*(log(x)/s)**2) for x > 0, s > 0.

lognorm takes s as a shape parameter.

The probability density above is defined in the “standardized” form. To shift and/or scale the distribution use the loc and scale parameters. Specifically, lognorm.pdf(x, s, loc, scale) is identically equivalent to lognorm.pdf(y, s) / scale with y = (x - loc) / scale.

A common parametrization for a lognormal random variable Y is in terms of the mean, mu, and standard deviation, sigma, of the unique normally distributed random variable X such that exp(X) = Y. This parametrization corresponds to setting s = sigma and scale = exp(mu).

(源自参考文档2)

所以要得到一般意义上符合对数正态分布的随机变量X(即,logX服从n(mu,sigma^2)),需要令lognorm中的参数s=sigma,loc=0,scale=exp(mu)。(详细论述见参考文档3和4)

参考文档:

[1]如何在Python中实现这五类强大的概率分布

http://python.jobbole.com/81321/

[2]scipy.stats文档

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html#scipy.stats.lognorm

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

http://stackoverflow.com/questions/8870982/how-do-i-get-a-lognormal-distribution-in-python-with-mu-and-sigma

[4]Fitting log-normal distribution in R vs. SciPy

http://stats.stackexchange.com/questions/33036/fitting-log-normal-distribution-in-r-vs-scipy

最新文章

  1. Java下好用的开源库推荐
  2. html图标插件
  3. nignx 启动,重启命令
  4. iOS 开发之使用safari对webview进行调试
  5. 分享11个纯css完成的图片浏览器
  6. Jmeter进行数据库压测
  7. js中加密及设置cookie
  8. python实现websocket服务器,可以在web实时显示远程服务器日志
  9. premake 在64位Ubuntu系统下编译32位GCC程序
  10. swift label不同颜色、不同字体
  11. 分享一次Oracle数据导入导出经历
  12. 【转】sed 高级用法
  13. 修改hosts不必重启 立刻生效
  14. centOS 安装gitlab-runner
  15. 常用cursor光标说明
  16. [SQL]SQL Prompt5的工具栏按钮介绍
  17. BTC和BCH 区别和联系?
  18. Docker关联使用的一些工具:Clip名字服务(转载)
  19. redis 介绍
  20. shiro+spring相关配置

热门文章

  1. Jenkins - 安装并启动Jenkins
  2. Python属性的查找顺序
  3. GIT讲解
  4. input获得焦点时,如何让外边框不变蓝
  5. rsync 使用
  6. c# NPOI文件操作
  7. c#连接Access数据库及增删改查作
  8. 使用PrintDocument定制打印格式
  9. 未检测到.NET CORE SDK 或者 新建项目没有.NET CORE 3.0选择项
  10. Angular2 环境的搭建