dTweedie: Density, derivatives, distribution function, and random...

Description Usage Arguments Details Value Author(s) References Examples

Description

Density, derivatives, distribution function, and random generation for the Tweedie distribution. The distribution is parameterised by the mean, dispersion parameter and the power parameter so that the distribution's variance is given by disperion * mean^power.

Usage

1
2
3
dTweedie( y, mu, phi, p, LOG=TRUE)
pTweedie( q, mu, phi, p)
rTweedie( n, mu, phi, p)

Arguments

y,q

vector of quantiles

n

number of random draws

mu

scalar or vector (length matches y or equal to n) of means

phi

scalar or vector (length matches y or equal to n) of dispersion parameters

p

scalar or vector (length matches y or equal to n) of power parameters

LOG

indication of return scale. If TRUE (default) then the density is returned on the log scale.

Details

The density calculation is based on the series summation method described in Dunn and Smyth (2005). These functions are really just wrappers to the equivalent functions dPoisGam, pPoisGam and rPoisGam. The functions are equivalent up to parameterisation of the distribution.

The distribution function is calculated by adaptive quadrature (a call to the integrate function). However, the point discontinuity at zero is handled explicitly by assuming the convention that the distribution function evaluated at zero is equal to the density at zero.

Value

dTweedie returns a numeric vector containing the (log-)densities.
pTweedie returns a numeric vector containing the values of the distribution function.
rTweedie returns a numeric vector containing the random variables.

Author(s)

Scott D. Foster

References

Dunn P. K. and Smyth G. K. (2005) Series evaluation of Tweedie exponential dispersion model densities. Statistics and Computing 15: 267-280.

Foster, S.D. and Bravington, M.V. (2013) A Poisson-Gamma Model for Analysis of Ecological Non-Negative Continuous Data. Journal of Environmental and Ecological Statistics 20: 533-552

Examples

1
2
3
4
5
6
my.seq <- seq( from=0, to=20, length=200)
par( mfrow=c( 1,2))
plot( my.seq, dTweedie( y=my.seq, mu=5, phi=2.1, p=1.6, LOG=FALSE),
 type='l', xlab="Variable", ylab="Density")
plot( my.seq, pTweedie( q=my.seq, mu=5, phi=2.1, p=1.6),
 type='l', xlab="Variable", ylab="Distribution")

Example output



fishMod documentation built on May 2, 2019, 1:10 p.m.

Related to dTweedie in fishMod...