Density function for the Tweedie EMDs using a saddlepoint approximation.
dtweedie_saddle(y, xi = NULL, mu, phi, eps = 1/6, power = NULL)dtweedie.saddle(y, xi = NULL, mu, phi, eps = 1/6, power = NULL)
A numeric vector of densities.
vector of quantiles.
scalar; the value of \(\xi\) such that the variance is \(\mbox{var}[Y]=\phi\mu^{\xi}\). A synonym for power.
vector of mean \(\mu\).
vector of dispersion parameters \(\phi\).
the offset in computing the variance function; the default is eps=1/6 (as suggested by Nelder and Pregibon, 1987).
scalar; a synonym for \(\xi\), the Tweedie index parameter.
The saddlepoint approximation is an approximation, not an exact evaluation, and
no warning is given when it is inaccurate.
Its relative error grows with \(z = \phi y^{p - 2}\),
and is roughly of order \(z/10\) or smaller (for example, exactly
\(z/12\) to first order for the gamma distribution, \(p = 2\));
it is small only when \(z\) is small.
For \(1 < p < 2\), the default offset eps = 1/6
(which keeps the density finite near \(y = 0\)) adds a further relative
error of about \((1 + \epsilon/y)^{-p/2} - 1\),
which does not shrink as \(\phi\) becomes small (about 11% at
\(y = 1\) when \(p = 1.5\)).
dtweedie() uses a corrected saddlepoint approximation only where
its estimated relative error is below \(10^{-13}\); use dtweedie()
for accurate densities.
Dunn, P. K. and Smyth, G. K. (2008). Evaluation of Tweedie exponential dispersion model densities by Fourier inversion. Statistics and Computing, 18, 73--86. 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. tools:::Rd_expr_doi("10.1007/s11222-005-4070-y")
Nelder, J. A. and Pregibon, D. (1987). An extended quasi-likelihood function Biometrika, 74(2), 221--232. tools:::Rd_expr_doi("10.1093/biomet/74.2.221")
# Plot a Tweedie density
y <- seq(0.01, 4, length = 50)
fy <- dtweedie_saddle(y, power = 1.1, mu = 1, phi = 1)
plot(y, fy, type = "l", lwd = 2, ylab = "Density")
Run the code above in your browser using DataLab