Learn R Programming

tweedie (version 3.0.14)

tweedie_profile: Profile Likelihood Estimate of Tweedie Variance Index Parameter

Description

This function profiles the (log-)likelihood over a vector of Tweedie power-index parameter (denoted \(p\) or \(\xi\)) to find the maximum likelihood estimate (MLE) of the index parameter \(p\) (or equivalently \(\xi\)).

Usage

tweedie_profile(formula, p.vec = NULL, xi.vec = NULL, link.power = 0, 
  data, weights = 1, offset = 0, fit.glm = FALSE, do.smooth = TRUE, 
  do.plot = FALSE, do.ci = do.smooth, eps = 1/6, 
  control = list( epsilon = 1e-09, maxit = stats::glm.control()$maxit, 
  trace = glm.control()$trace ),
  do.points = do.plot, method = "inversion", conf.level = 0.95, 
  phi.method = ifelse(method == "saddlepoint", "saddlepoint", "mle"), 
  verbose = FALSE, add0 = FALSE)

tweedie.profile( formula, p.vec = NULL, xi.vec = NULL, link.power = 0, data, weights = 1, offset = 0, fit.glm = FALSE, do.smooth = TRUE, do.plot = FALSE, do.ci = do.smooth, eps = 1/6, control = list(epsilon = 1e-09, maxit = stats::glm.control()$maxit, trace = glm.control()$trace), do.points = do.plot, method = "inversion", conf.level = 0.95, phi.method = ifelse(method == "saddlepoint", "saddlepoint", "mle"), verbose = FALSE, add0 = FALSE )

Arguments

formula

a formula expression as for other regression models and generalized linear models, of the form response ~ predictors.

p.vec

a vector of \(p\) values for consideration. The values must all be larger than one. If the response has zeros, values must be \(1 < p < 2\). If NULL (default), p.vec is set automatically.

xi.vec

a synonym for p.vec, as some authors use the \(\xi\) notation.

link.power

the power link function to use in the tweedie glm family. These link functions \(g(\cdot)\) are of the form \(g(\eta)=\eta^{link.power}\), where link.power = 0 (default) refers to the logarithm link function.

data

an optional data frame, list or environment containing the variables.

weights

an optional vector of weights to be used in the fitting process.

offset

an a priori known component included in the linear predictor. See model.offset.

fit.glm

logical; if TRUE, the Tweedie glm is fitted using the value of \(p\) found by the profiling function. The default is FALSE.

do.smooth

logical; if TRUE (default), a spline is fitted to the data to smooth the profile likelihood plot. Note that p.vec must contain at least five points for smoothing.

do.plot

logical; if TRUE, a plot of the profile likelihood is produced. The default is FALSE.

do.ci

logical; if TRUE, the nominal 100*conf.level is computed. Defaults to the value of do.smooth. Confidence intervals are only computed if do.smooth = TRUE.

eps

the offset in computing the variance function. Default is 1/6 (as recommended by Nelder and Pregibon, 1987). eps is ignored unless method = "saddlepoint".

control

a list of parameters for controlling the fitting process;

do.points

logical; if TRUE, the points used to compute the likelihood as given by p.vec (or equivalently, xi.vec) are explicitly shown by points. The defaults is the value of do.plot.

method

the method of evaluation; one of saddlepoint, interpolation, series or inversion (the default).

conf.level

the level of confidence for the confidence intervals; the default is 0.95 (for \(95\%\) confidence intervals).

phi.method

the method used to estimate \(\phi\); one of saddlepoint, mle (the default).

verbose

logical; if TRUE, some details of the calculations are shown. The default is FALSE.

add0

logical; if TRUE, adds \(P(Y = 0)\) to the plot. The default is FALSE.

Details

For each value in p.vec, the function computes an estimate of \(\phi\) and then computes the value of the log-likelihood for these parameters. The plot of the log-likelihood against p.vec allows the maximum likelihood value of \(p\) to be found. Once \(p\) is found, the distribution within the class of Tweedie distributions is identified.

References

Dunn, P. K. and Smyth, G. K. (2018). Generalized linear models with examples in R. Springer. tools:::Rd_expr_doi("10.1007/978-1-4419-0118-7")

Examples

Run this code
data(rock)
out <- tweedie_profile(perm~1, data=rock, do.plot=FALSE, 
                       xi.vec=seq(1.5, 2.75, length=11))

# The estimate for the variance power index (p, or xi) is:
out$p.max

Run the code above in your browser using DataLab