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.922839sd(sample)#> [1] 2.818425hist(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: 0x7ff900e9a6b0> #> <environment: namespace:NCoVUtils>