简体   繁体   English

从指数分布生成随机数

[英]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.

相关问题 如何从总和为1的指数分布中生成随机数(概率) - how to generate random numbers (probabilities) from exponential distribution that sum up to 1 当大小是R中的泊松随机变量的数目时,如何从指数分布中生成随机数? - How to generate random number from exponential distribution when the sizes are the numbers of Poisson random variable in R? set.seed从具有不同参数的指数分布中产生相同的随机数 - set.seed causes the same random numbers from exponential distribution with different parameter 模拟从R中的截断逻辑分布生成随机数 - Simulation to generate random numbers from a truncated logistic distribution in R 从定义范围 [min, max] 的泊松分布生成随机数 - Generate random numbers from a Poisson distribution with defined range [min, max] 从混合生成随机数,并将每个分布的结果按顺序排列 - Generate random numbers from mixture and put outcome of each distribution in sequence 如何从负二项分布生成n个随机数? - How to generate n random numbers from negative binomial distribution? 在 R 中生成卡方分布的随机数 - Generate random numbers of a chi squared distribution in R 从正态分布生成数字 - Generate numbers from normal distribution 如何生成正态分布和均匀分布的随机数 - How to generate random numbers with normal distribution and uniform distribution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM