| Tweedie | R Documentation |
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).
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)
y |
vector of quantiles. |
xi |
scalar; the value of |
mu |
vector of mean |
phi |
vector of dispersion parameters |
power |
scalar; a synonym for |
verbose |
logical; if |
q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. |
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:
Evaluation of an infinite series (dtweedie_series).
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.
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.
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.
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.
dtweedie_series, dtweedie_inversion, ptweedie_series, ptweedie_inversion, dtweedie_saddle, tweedie_lambda
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.