Derivatives of the log-likelihood with respect to *phi*

1 2 | ```
dtweedie.dldphi(phi, mu, power, y )
dtweedie.dldphi.saddle(phi, mu, power, y )
``` |

`y` |
vector of quantiles |

`mu` |
the mean |

`phi` |
the dispersion |

`power` |
the value of |

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`

,
the distributions are still defined but cannot be written in closed form,
and hence evaluation is very difficult.
the value of the derivative
*d(l)/d(phi)*
where *l* is the log-likelihood for the specified
Tweedie distribution.
`dtweedie.dldphi.saddle`

uses the saddlepoint approximation to determine the derivative;
`dtweedie.dldphi`

uses an infinite series expansion.

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.

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.saddle`

,
`dtweedie`

,
`tweedie.profile`

,
`tweedie`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
### Plot dl/dphi against candidate values of phi
power <- 2
mu <- 1
phi <- seq(2, 8, by=0.1)
set.seed(10000) # For reproducability
y <- rtweedie( 100, mu=mu, power=power, phi=3)
# So we expect the maximum to occur at phi=3
dldphi <- dldphi.saddle <- array( dim=length(phi))
for (i in (1:length(phi))) {
dldphi[i] <- dtweedie.dldphi( y=y, power=power, mu=mu, phi=phi[i])
dldphi.saddle[i] <- dtweedie.dldphi.saddle( y=y, power=power, mu=mu, phi=phi[i])
}
plot( dldphi ~ phi, lwd=2, type="l",
ylab=expression(phi), xlab=expression(paste("dl / d",phi) ) )
lines( dldphi.saddle ~ phi, lwd=2, col=2, lty=2)
legend( "bottomright", lwd=c(2,2), lty=c(1,2), col=c(1,2),
legend=c("'Exact' (using series)","Saddlepoint") )
# Neither are very good in this case!
``` |

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

Please suggest features or report bugs with the GitHub issue tracker.

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