rgamma_with_mean_sd.Rd
Mean and standard deviation parameterised gamma sampling function
rgamma_with_mean_sd(n, mean, sd)
n | Numeric, the number of samples to take. |
---|---|
mean | Numeric, the mean of the distribution. |
sd | Numeric the standard deviation of the distribution. |
A vector of samples from the gamma distribution
#> [1] 1.921294sd(sample)#> [1] 2.818776hist(sample)## Code rgamma_with_mean_sd#> function (n, mean, sd) #> { #> theta <- sd^2/mean #> k <- mean/theta #> stats::rgamma(n, shape = k, scale = theta) #> } #> <bytecode: 0x55a6b2087558> #> <environment: namespace:WuhanSeedingVsTransmission>