Plotting Tweedie density and distribution functions

1 |

`y` |
vector of values at which to evaluate and plot |

`xi` |
the value of |

`power` |
a synonym for |

`mu` |
the mean |

`phi` |
the dispersion |

`type` |
what to plot: |

`add` |
if |

`...` |
Arguments to be passed to the plotting method |

For details, see `dtweedie`

this function is usually called for side-effect of
producing a plot of the specified Tweedie distribution,
properly plotting the exact zero that occurs at *y=0*
when *1<p<2*.
However,
it also produces a list with the computed density at the given points,
with components `y`

and `x`

respectively,
such that `plot(y~x)`

approximately reproduces the plot.

Peter Dunn (pdunn2@usc.edu.au)

Dunn, P. K. and Smyth, G. K. (2008).
Evaluation of Tweedie exponential dispersion model densities by Fourier inversion.
*Statistics and Computing*,
**18**, 73–86.

Dunn, Peter K and Smyth, Gordon K (2005).
Series evaluation of Tweedie exponential dispersion model densities
*Statistics and Computing*,
**15**(4). 267–280.

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.

Nolan, John P (1997).
Numerical calculation of stable densities and distribution functions.
*Communication in Statistics—Stochastic models*,
**13**(4). 759–774.

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.

`dtweedie`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
### Plot a Tweedie density with 1<p<2
yy <- seq(0,5,length=100)
tweedie.plot( power=1.7, mu=1, phi=1, y=yy, lwd=2)
tweedie.plot( power=1.2, mu=1, phi=1, y=yy, add=TRUE, lwd=2, col="red")
legend("topright",lwd=c(2,2), col=c("black","red"), pch=c(19,19),
legend=c("p=1.7","p=1.2") )
### Plot distribution functions
tweedie.plot( power=1.05, mu=1, phi=1, y=yy,
lwd=2, type="cdf", ylim=c(0,1))
tweedie.plot( power=2, mu=1, phi=1, y=yy,
add=TRUE, lwd=2, type="cdf",col="red")
legend("bottomright",lwd=c(2,2), col=c("black","red"),
legend=c("p=1.05","p=2") )
### Now, plot two densities, combining p>2 and 1<p<2
tweedie.plot( power=3.5, mu=1, phi=1, y=yy, lwd=2)
tweedie.plot( power=1.5, mu=1, phi=1, y=yy, lwd=2, col="red", add=TRUE)
legend("topright",lwd=c(2,2), col=c("black","red"), pch=c(NA,19),
legend=c("p=3.5","p=1.5") )
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.