Description Usage Arguments Value Author(s) Examples
Calculates shape and scale parameters for a gamma distribution from the mean
and standard deviation of the distribution, or vice-versa. One supplies
either mean
and sd
or shape
and scale
and the
function returns a list with all four parameter values.
1 |
... |
This function can be run either supplying |
A list with mean
, sd
, shape
and scale
parameters of the corresponding gamma distribution.
David M. Kaplan dmkaplan2000@gmail.com
1 2 3 4 5 6 7 8 9 10 | library(ConnMatTools)
mn <- 1
sd <- 0.4
l <- gammaParamsConvert(mean=mn,sd=sd)
x <- seq(0,2,length.out=50)
# Plot gamma and normal distributions - for sd << mean, the two should be very close
plot(x,dgamma(x,l$shape,scale=l$scale),
main="Normal versus Gamma distributions",type="l")
lines(x,dnorm(x,l$mean,l$sd),col="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.