View source: R/dtweedie_inversion.R
| dtweedie_inversion | R Documentation |
Evaluates the probability density function (pdf) for Tweedie distributions using Fourier inversion,
for given values of the dependent variable y, the mean mu, dispersion phi, and power parameter power.
Not usually called by general users, but can be used in the case of evaluation problems.
dtweedie_inversion(y, mu, phi, power, method = 3, verbose = FALSE,
details = FALSE, IGexact = TRUE)
dtweedie.inversion(y, power, mu, phi, method = 3, verbose, details)
y |
vector of quantiles. |
mu |
the mean parameter |
phi |
the dispersion parameter |
power |
scalar; the power parameter |
method |
the method to use; one of |
verbose |
logical; if |
details |
logical; if |
IGexact |
logical; if |
A numeric vector of densities if details=FALSE; if details = TRUE, a list containing denisty (a vector of the values of the density), regions (a vector of the number of integration regions used),method (a vector giving the evaluation method used; see the Note below on the three methods), and exitstatus (a vector, where a 1 for any value means a computational problem or target relative accuracy not reached, for the corresponding observation).
The 'exact' values for the inverse Gaussian distribution are not really exact, but evaluated using inverse normal distributions,
for which very good numerical approximation are available in R.
For special cases of p (i.e., p = 0, 1, 2, 3), where no inversion is needed, regions and method are set to NA for all values of y.
For special cases of y for other values of p (i.e., P(Y = 0)), regions and method are set to NA.
The three methods are described in Dunn & Smyth (2008).
Dunn, P. K. and Smyth, G. K. (2008). Evaluation of Tweedie exponential dispersion model densities by Fourier inversion. Statistics and Computing, 18, 73–86. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11222-007-9039-6")}
Dunn, P. K. and Smyth, G. K. (2008). Evaluation of Tweedie exponential dispersion model densities by Fourier inversion. Statistics and Computing, 18, 73–86. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11222-007-9039-6")}
# Plot a Tweedie density
y <- seq(0.02, 4, length = 50)
fy <- dtweedie_inversion(y, mu = 1, phi = 1, power = 1.1)
plot(y, fy, type = "l", lwd = 2, ylab = "Density")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.