Skip to contents

Shape shape and scale scale: mean shape * scale, variance shape * scale^2, as in stats::dgamma(). gamma_from_mean_cv() takes the mean and coefficient of variation; gamma_from_mean_dispersion() the GLM parameterization, mean mu and dispersion phi (variance phi * mu^2). Properties: d@shape, d@scale.

Usage

gamma_distribution(shape, scale, ptr = NULL)

gamma_from_mean_cv(mean, cv)

gamma_from_mean_dispersion(mean, dispersion)

Arguments

shape, scale

Finite and positive.

mean

Mean; finite and positive.

cv

Coefficient of variation; finite and positive.

dispersion

GLM dispersion phi; finite and positive.

Value

A gamma_distribution object, which inherits from distribution.

Details

Supports the same operations as pareto, plus log_density().

Examples

g <- gamma_from_mean_cv(1000, 0.5)
g@shape
#> [1] 4
layer(g, 1000, 1000)
#> [1] 180.4946