dtweedie               package:tweedie               R Documentation

_T_w_e_e_d_i_e _D_i_s_t_r_i_b_u_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     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)

_A_r_g_u_m_e_n_t_s:

    y, q: vector of quantiles

       p: vector of probabilities

       n: the number of observations

   power: the value of power such that the variance is  var(Y) = phi *
          mu^power

      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 often
          less accurate; the exact zero W-algorithm can be slower but
          generally improves accuracy. 

  rotate: logical flag; if 'TRUE' (the default), the algorithm rotates
          before inverting the solution,  which has the effect of
          increasing the relative accuracy.

_D_e_t_a_i_l_s:

     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 var(Y) = phi * mu^power where power is
     greater than or equal to one, or less than or equal to zero. *This
     function only evaluates for power greater than or equal to one.*
     Special cases include the  normal (power=0), Poisson (power=1 with
     phi=1), gamma (power=2) and inverse Gaussian (power=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 1 < power < 2, the distribution are continuous for Y greater
     than zero, with a positive mass at Y=0. For power > 2,  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 power > 2
     and for 1 < power < 2. 

     The function 'dtweedie.series' evaluates the density using a
     series expansion;  a different series expansion is used for power
     > 2 and for 1 < power < 2. The function 'ptweedie.series' does
     likewise for the  cumulative probabilities but only for 1 < power
     < 2. 

     The function 'dtweedie' 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.

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Peter Dunn (dunn@usq.edu.au)

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     'dtweedie.saddle'

_E_x_a_m_p_l_e_s:

     ### 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)

