Learn R Programming

distributional (version 0.9.0)

dist_tweedie: The Tweedie distribution

Description

The Tweedie distribution is a family of exponential dispersion models characterised by a power variance function \(\mathrm{Var}(X) = \phi \mu^p\). For a power parameter \(p \in (1, 2)\), it corresponds to a compound Poisson-Gamma distribution: a Poisson-distributed number of events occur, each contributing a Gamma-distributed amount. This produces a distribution with a point mass at zero (when no events occur) mixed with a continuous, positive, right-skewed component, making it well suited to intermittent or non-negative data such as insurance claims and rainfall.

Usage

dist_tweedie(mean = 1, dispersion = 1, power = 1.5)

Arguments

mean

vector of means.

dispersion

vector of dispersion parameters.

power

vector of power parameters.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_tweedie.html

In the following, let \(X\) be a Tweedie random variable with parameters mean = \(\mu > 0\), dispersion = \(\phi > 0\), and power = \(p \in (1, 2)\).

Support: \(\{0\} \cup (0, \infty)\)

Mean: \(\mu\)

Variance: \(\phi \mu^p\)

Probability density function (p.d.f):

The Tweedie distribution does not have a closed-form density. Instead, it is defined as a Poisson sum of Gamma random variables, with \(P(X = 0) = \exp(-\lambda)\) and, for \(x > 0\),

$$ f(x) = \sum_{j=1}^{\infty} \frac{\lambda^j e^{-\lambda}}{j!} \frac{x^{j \alpha - 1} e^{-x / \gamma}}{\gamma^{j \alpha} \Gamma(j \alpha)} $$

where \(\lambda = \mu^{2 - p} / (\phi (2 - p))\) is the Poisson rate, \(\alpha = (2 - p) / (p - 1)\) is the Gamma shape per event, and \(\gamma = \phi (p - 1) \mu^{p - 1}\) is the Gamma scale. The density is evaluated using the series expansion of Dunn & Smyth (2005).

Cumulative distribution function (c.d.f):

The cumulative distribution function is evaluated numerically from the density series, as it does not have a closed-form expression.

References

Dunn, P. K., & Smyth, G. K. (2005). Series evaluation of Tweedie exponential dispersion model densities. Statistics and Computing, 15(4), 267-280. tools:::Rd_expr_doi("10.1007/s11222-005-4070-y").

See Also

tweedieDistr::tweedie

Examples

Run this code
dist <- dist_tweedie(mean = c(1, 2, 5), dispersion = 0.8, power = 1.5)
dist

if (FALSE) { # requireNamespace("tweedieDistr", quietly = TRUE)
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)
support(dist)
generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)
}

Run the code above in your browser using DataLab