tweedie-package: Tweedie Distributions

Description Details Author(s) References Examples

Description

Functions for computing and fitting the Tweedie family of distributions

Details

Package: tweedie
Type: Package
Version: 2.2.3
Date: 2015-07-06
License: GPL (>=2)

Author(s)

Peter K Dunn

Maintainer: Peter K Dunn <[email protected]>

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.

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.

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Generate random numbers
set.seed(987654)
y <- rtweedie( 25, xi=1.5, mu=1, phi=1)
	# With Tweedie index  xi   between 1 and 2, this produces continuous
	# data with exact zeros
x <- rnorm( length(y), 0, 1)  # Unrelated predictor

# With exact zeros, Tweedie index  xi  must be between 1 and 2

# Fit the tweedie distribution; expect  xi  about 1.5
library(statmod)
out <- tweedie.profile( y~1, xi.vec=seq(1.1, 1.9, length=9), do.plot=TRUE)
out$xi.max

# Plot this distribution
tweedie.plot( seq(0, max(y), length=1000), mu=mean(y), 
              xi=out$xi.max, phi=out$phi.max)

# Fit the glm
require(statmod) # Provides  tweedie  family functions
summary(glm( y ~ x, family=tweedie(var.power=out$xi.max, link.power=0) ))

Example output

1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 
.........Done.
[1] 1.459184

Call:
glm(formula = y ~ x, family = tweedie(var.power = out$xi.max, 
    link.power = 0))

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.8067  -0.3381  -0.1875   0.1875   1.3883  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept)  -0.4585     0.1898  -2.416    0.024 *
x            -0.1174     0.1656  -0.709    0.486  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for Tweedie family taken to be 0.6202546)

    Null deviance: 23.427  on 24  degrees of freedom
Residual deviance: 23.150  on 23  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 4

tweedie documentation built on May 29, 2017, 8:28 p.m.