[英]Plotting gamma distribution in R
Am trying to plot a gamma distribution histogram using R 我正在尝试使用R绘制伽玛分布直方图
so i have 所以我有
gam(10, 0.5)
I have previously calculated mean as 我之前已经计算出平均值
10* 0.5 = 5
So Am supposed to plot a histoigram of 100 observations with scale = 10 and shape = 0.5
因此,我应该绘制100个观测值的组织图,
scale = 10 and shape = 0.5
So i have tried 所以我尝试了
x <- round(rgamma(100,shape = 0.5,rate = 10),1)
hist(x)
and i get 我得到
which is wrong as the mean is supposed to be 5 but my plot doesnt produce 5 这是错误的,因为均值应该是5,但我的情节不会产生5
Where am i going wrong? 我要去哪里错了?
Use scale
instead of rate
. 使用
scale
代替rate
。 So simulate your data as follows: 因此,如下模拟数据:
rgamma(100,shape = 0.5,scale = 10)
Read the documentation for more information. 阅读文档以获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.