dtweedie

0th

Percentile

Tweedie Distributions

Density, distribution function, quantile function and random generation for the Tweedie distributions

Keywords
models
Usage
dtweedie(y, power, mu, phi)
dtweedie.series(y, power, mu, phi)
dtweedie.inversion(y, power, mu, phi, exact=FALSE, rotate=TRUE)
ptweedie(q, power, mu, phi)
ptweedie.series(q, power, mu, phi)
qtweedie(p, power, mu, phi)
rtweedie(n, power, mu, phi)
Arguments
y, q
vector of quantiles
p
vector of probabilities
n
the number of observations
power
the value of $p$ such that the variance is $\mbox{var}[Y]=\phi\mu^p$
mu
the mean
phi
the dispersion
exact
logical flag; if TRUE, the exact zero $W$-algorithm of Sidi (1982) is used. If FALSE (the default), the (approximate zero) modified $W$-algorithm of Sidi (1988) is used. The modified algorithm requires less computation but is of
rotate
logical flag; if TRUE (the default), the algorithm rotates before inverting the solution, which has the effect of increasing the relative accuracy.
Details

The Tweedie family of distributions belong to the class of exponential dispersion models (EDMs), famous for their role in generalized linear models. The Tweedie distributions are the EDMs with a variance of the form $\mbox{var}[Y]=\phi\mu^p$ where $p$ is greater than or equal to one, or less than or equal to zero. This function only evaluates for $p$ greater than or equal to one. Special cases include the normal ($p=0$), Poisson ($p=1$ with $\phi=1$), gamma ($p=2$) and inverse Gaussian ($p=3$) distributions. For other values of power, the distributions are still defined but cannot be written in closed form, and hence evaluation is very difficult.

When $12$, the distributions are continuous for $Y$ greater than zero.

This function evaluates the density or cumulative probability using one of two methods, depending on the combination of parameters. One method is the evaluation of an infinite series. The second interpolates some stored values computed from a Fourier inversion technique. The function dtweedie.inversion evaluates the density using a Fourier series technique; ptweedie.inversion does likewise for the cumulative probabilities. The actual code is contained in an external FORTRAN program. Different code is used for $p>2$ and for $1dtweedie.series evaluates the density using a series expansion; a different series expansion is used for $p>2$ and for $1ptweedie.series does likewise for the cumulative probabilities but only for $1dtweedie uses a two-dimensional interpolation procedure to compute the density for some parts of the parameter space from previously computed values found from the series or the inversion. For other parts of the parameter space, the series solution is found. ptweedie returns either the computed series solution or inversion solution.

Value

  • density (dtweedie), probability (ptweedie), quantile (qtweedie) or random sample (rtweedie) for the given Tweedie distribution with parameters mu, phi and power.

References

Dunn, Peter K and Smyth, Gordon K (To appear). Series evaluation of Tweedie exponential dispersion model densities Statistics and Computing.

Dunn, Peter K and Smyth, Gordon K (2001). Tweedie family densities: methods of evaluation. Proceedings of the 16th International Workshop on Statistical Modelling, Odense, Denmark, 2--6 July

Jorgensen, B. (1987). Exponential dispersion models. Journal of the Royal Statistical Society, B, 49, 127--162.

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

Sidi, Avram (1982). The numerical evaluation of very oscillatory infinite integrals by extrapolation. Mathematics of Computation 38(158), 517--529.

Sidi, Avram (1988). A user-friendly extrapolation method for oscillatory infinite integrals. Mathematics of Computation 51(183), 249--266.

Tweedie, M. C. K. (1984). An index which distinguishes between some important exponential families. Statistics: Applications and New Directions. Proceedings of the Indian Statistical Institute Golden Jubilee International Conference (Eds. J. K. Ghosh and J. Roy), pp. 579-604. Calcutta: Indian Statistical Institute.

See Also

dtweedie.saddle

Aliases
  • dtweedie
  • dtweedie.series
  • dtweedie.inversion
  • ptweedie
  • ptweedie.series
  • ptweedie.inversion
  • qtweedie
  • rtweedie
Examples
### Plot a Tweedie density
power <- 2.5
mu <- 1 
phi <- 1 
y <- seq(0, 10, length=100) 
fy <- dtweedie( y=y, power=power, mu=mu, phi=phi) 
plot(y, fy, type="l")
# Compare to the saddlepoint density
f.saddle <- dtweedie.saddle( y=y, power=power, mu=mu, phi=phi) 
lines( y, f.saddle, col=2 )

### A histogram of Tweedie random numbers
hist( rtweedie( 1000, power=1.2, mu=1, phi=1) )

### An example of the multimodal feature of the Tweedie
### family with power near 1 (from the first reference
### listed above).
y <- seq(0.001,2,len=1000)
mu <- 1
phi <- 0.1
p <- 1.02
f1 <- dtweedie(y,mu=mu,phi=phi,power=p)
plot(y, f1, type="l", xlab="y", ylab="Density")
p <- 1.05
f2<- dtweedie(y,mu=mu,phi=phi,power=p)
lines(y,f2, col=2)
Documentation reproduced from package tweedie, version 1.01, License: GPL version 2 or newer

Community examples

Looks like there are no examples yet.