gamma_params: Calculate shape and scale (or rate) parameters of a gamma...

Description Usage Arguments Value Details References Examples

Description

Function to calculate the shape, α, and scale, θ, (or rate, β) parameteres of a gamma distribution based on the method of moments (MoM) using the mean μ and standard deviation σ of the random variable of interest.

Usage

1

Arguments

mu

Scalar with the mean of the random variable.

sigma

Scalar with the standard deviation of the random variable.

scale

Logical variable indicating scale parameterization of gamma distribution (Default is TRUE). If FALSE, rate parameterization is retrieved

Value

shape Shape parameter of gamma distribution scale Scale parameter of gamma distribution (If scale=TRUE) rate Rate parameter of gamma distribution (If scale=FALSE)

Details

Based on method of moments. If μ is the mean and σ is the standard deviation of the random variable, then the the shape, α, scale, θ, and rate, β, parameteres are computed as follows

α=\frac{μ^2}{σ^2},

θ = \frac{σ^2}{μ}

and

β = \frac{μ}{σ^2}

References

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
mu    <- 2
sigma <- 1
# Scale specification 
gamma_params(mu, sigma)
# Rate specification 
gamma_params(mu, sigma, scale = FALSE)

## End(Not run)

feralaes/dampack documentation built on May 16, 2019, 12:48 p.m.