问题描述
我想从对数正态分布中获得20个随机生成的数字,其几何平均值为10,几何标准偏差为2.5.
I would like to get 20 randomly generated numbers from a lognormal distribution with the geometric mean of 10 and geometric standard deviation of 2.5.
我应该使用哪个R函数来完成此任务?
Which R function should I use to accomplish this task?
谢谢您的帮助!
推荐答案
rlnorm
函数:
rlnorm(20, log(10), log(2.5))
通常,R中的分布通常以d,p,q,r形式提供,这些字母排在最前面,然后是分布词干:norm
,lnorm
,unif
,gamma
,...他们的帮助页面将包含参数的细节,如果使用weibull
或其他约定没有完全标准化的发行版,则这是必不可少的.
More generally distributions in R are generally available in d,p,q,r forms with those letters coming first followed by the distribution stem: norm
, lnorm
, unif
, gamma
, ... etc. Their help pages will contain the specifics of the parameters, which can be essential if working with weibull
or other distribution for which conventions are not completely standardized (as it were).
这篇关于如何在R中生成具有指定对数正态分布的随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!