gamma.params: Find parameters of Gamma distribution

Description Usage Arguments Value Author(s) Examples

Description

A function that finds the shape and rate paramters required by the Gamma distribution given the observed mean mu and standard deviation sigma

Usage

1
2
## S3 method for class 'params'
gamma(mu, sigma)

Arguments

mu

the desired mean of the Gamma distribution

sigma

the desired standard deviation of the Gamma distribution

Value

a named numeric vector giving the shape and rate parameters of the Gamma distribution

Author(s)

John Giles

Examples

1
2
3
4
5
6
7
prm <- gamma.params(mu=15.3, sigma=9.3)

prm[1]/prm[2] # mean
sqrt(prm[1]/(prm[2]^2)) # sd

plot(density(rgamma(n=1000, shape=prm[1], rate=prm[2])), main='')
abline(v=15.3, lty=2, col='red')

gilesjohnr/genpatch documentation built on May 12, 2019, 10:50 a.m.