[英]Generate random numbers from an exponential distribution
Using R, I want to generate 100 random numbers from an exponential distribution with a mean of 50. I want to store these numbers in a vector.使用 R,我想从平均值为 50 的指数分布中生成 100 个随机数。我想将这些数字存储在一个向量中。 I think I did it correctly, but I cannot find anything on the internet to verify my code.
我认为我做对了,但我在互联网上找不到任何东西来验证我的代码。 Here is my code:
这是我的代码:
vector <- rexp(100,50)
Solution:解决方案:
vector <- rexp(100, 1/50)
(answered in comments by @SeverinPappadeux ) (在@SeverinPappadeux 的评论中回答)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.