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.

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. doi:10.1007/s11222-005-4070-y .

Examples

dist <- dist_tweedie(mean = c(1, 2, 5), dispersion = 0.8, power = 1.5)
dist
#> <distribution[3]>
#> [1] Tweedie(1, 0.8, 1.5) Tweedie(2, 0.8, 1.5) Tweedie(5, 0.8, 1.5)

mean(dist)
#> [1] 1 2 5
variance(dist)
#> [1] 0.800000 2.262742 8.944272
skewness(dist)
#> [1] 1.3416408 1.1281809 0.8972093
kurtosis(dist)
#> [1] 2.400000 1.697056 1.073313
support(dist)
#> <support_region[3]>
#> [1] [0,Inf) [0,Inf) [0,Inf)
generate(dist, 10)
#> [[1]]
#>  [1] 1.6663581 0.7329503 1.6452619 1.0680827 1.0634947 1.2149686 2.0558154
#>  [8] 0.5815822 0.5260334 1.4536237
#> 
#> [[2]]
#>  [1] 3.9908749 1.1591358 1.8763121 5.6959796 1.9994791 1.2153560 0.2518184
#>  [8] 3.7678308 1.8986619 1.2309488
#> 
#> [[3]]
#>  [1]  1.2442718  2.1360943  5.2422101  7.2506007 11.6462720  4.8927800
#>  [7]  8.5335361  1.5312366  0.1432264  4.0820178
#> 

density(dist, 2)
#> [1] 0.1630784 0.2504259 0.1176828
density(dist, 2, log = TRUE)
#> [1] -1.813524 -1.384592 -2.139762

cdf(dist, 4)
#> [1] 0.9916669 0.8964663 0.4237844

quantile(dist, 0.7)
#> [1] 1.294394 2.550122 6.203619