Tweedie: Tweedie distributions

TweedieR Documentation

Tweedie distributions

Description

Density, distribution function, quantile function and random generation for the the Tweedie family of distributions, with mean mu, dispersion parameter phi and variance power power (or xi, a synonym for power).

Usage

dtweedie(y, xi = NULL, mu, phi, power = NULL, verbose = FALSE)

ptweedie(q, xi = NULL, mu, phi, power = NULL, verbose = FALSE)

qtweedie(p, xi = NULL, mu, phi, power = NULL)

rtweedie(n, xi = NULL, mu, phi, power = NULL)

ptweedie(q, xi = NULL, mu, phi, power = NULL, verbose = FALSE)

qtweedie(p, xi = NULL, mu, phi, power = NULL)

rtweedie(n, xi = NULL, mu, phi, power = NULL)

Arguments

y

vector of quantiles.

xi

scalar; the value of \xi such that the variance is \mbox{var}[Y]=\phi\mu^{\xi}. A synonym for power.

mu

vector of mean \mu.

phi

vector of dispersion parameters \phi.

power

scalar; a synonym for \xi, the Tweedie index parameter.

verbose

logical; if TRUE, some details of the algorithms used is shown. The default is FALSE.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Details

The Tweedie edms belong to the class of exponential dispersion models (edms), known for their role in generalized linear models (glms). The Tweedie distributions are the edms with a variance of the form \mbox{var}[Y] = \phi\mu^p where p \ge 1. This function only evaluates for p \ge 1.

Special cases are the Poisson (p = 1 with \phi = 1), gamma (p = 2), and inverse Gaussian (p = 3) distributions. Evaluation is difficult for p outside of p = 0, 1, 2, 3. This function uses one of two primary methods, depending on the combination of parameters:

  1. Evaluation of an infinite series (dtweedie_series).

  2. Interpolation from stored values computed via a Fourier inversion technique (dtweedie_inversion).

This function employs a two-dimensional interpolation procedure to compute the density for some parts of the parameter space from previously computed values (interpolation) and uses the series solution for others.

When 1<p<2, the density function include a positive probably for Y = 0.

Value

dtweedie gives the density, ptweedie gives the distribution function, qtweedie gives the quantile function, and rtweedie generates random deviates.

The length of the result is determined by n for rtweedie, and by the length of mu for other functions.

Note

dtweedie and ptweedie are the only functions generally to be called by users. Consequently, all checks on the function inputs are performed in these functions.

References

Dunn, P. K. and Smyth, G. K. (2008). Evaluation of Tweedie exponential dispersion model densities by Fourier inversion. Statistics and Computing, 18, 73–86. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11222-007-9039-6")}

Dunn, Peter K and Smyth, Gordon K (2005). Series evaluation of Tweedie exponential dispersion model densities Statistics and Computing, 15(4). 267–280. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11222-005-4070-y")}

Jorgensen, B. (1997). Theory of Dispersion Models. Chapman and Hall, London.

See Also

dtweedie_series, dtweedie_inversion, ptweedie_series, ptweedie_inversion, dtweedie_saddle, tweedie_lambda

Examples

# Compute a Tweedie density
power <- 1.1
mu <- 1
phi <- 1
y <- seq(0, 5, by = 0.5)
dtweedie(y, power = power, mu = mu, phi = phi)

# Compare to the saddlepoint density
dtweedie_saddle(y = y, power = power, mu = mu, phi = phi)

# The DF:
ptweedie(y, power = power, mu = mu, phi = phi)


tweedie documentation built on Feb. 7, 2026, 5:07 p.m.