Learn R Programming

VGAM (version 0.8-1)

frechet: Frechet Distribution Family Function

Description

Maximum likelihood estimation of the 2-parameter and 3-parameter Frechet distribution.

Usage

frechet2(location=0, lscale="loge", lshape="loglog", escale = list(),
         eshape = list(), iscale=NULL, ishape=3, zero=NULL)
frechet3(anchor=NULL, ldifference="loge", lscale="loge", lshape="loglog",
         edifference=list(), escale = list(), eshape = list(),
         ilocation=NULL, iscale=NULL, ishape=3, zero=NULL,
         effpos = .Machine$double.eps^0.75)

Arguments

location
Numeric. Location parameter. It is called $a$ below.
lscale, lshape
Link functions for the parameters. See Links for more choices.
iscale, ishape
Initial value for the scale and shape parameters respectively. Both parameters must be positive. A NULL means it is chosen internally.
edifference, escale, eshape
Extra argument for the respective links. See earg in Links for general information.
zero
An integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. The value must be from the set {1,2}, corresponding respectively to $scale$ and $shape$. By default all linear/additive predictors are modelled
anchor
An ``anchor'' point for estimating the location parameter. This must be a value no greater than min(y) where y is the response. The location parameter is $A - D$ where $A$ is the anchor, $D$ is the ``difference'' (default
ldifference
Parameter link function for the difference $D$ between the anchor point and the location parameter estimate. The default keeps this difference positive so that numerical problems are less likely to occur.
ilocation
Optional initial value for the location parameter. A good choice can speed up the convergence rate markedly. A NULL means it is chosen internally.
effpos
A small number, usually positive, to pass into the quasi-Newton updating function. A value greater than effpos is considered effectively positive.

Value

  • An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.

Warning

Convergence for frechet3 can be very slow, especially if the initial value for the location parameter is poor. Setting something like maxit=200, trace=TRUE is a good idea.

Details

The Frechet distribution has a density function that can be written $$f(y) = \frac{sb}{(y-a)^2} [b/(y-a)]^{s-1} \, \exp[-(b/(y-a))^s]$$ for $y>a$ and scale parameter $b>0$. The positive shape parameter is $s$. The cumulative distribution function is $$F(y) = \exp[-(b/(y-a))^s].$$ The mean of $Y$ is $a + b \Gamma(1-1/s)$ for $s>1$ (these are returned as the fitted values). Note that the loglog link ensures $s>1$. The variance of $Y$ is $b^2 [ \Gamma(1-2/s) - \Gamma^2(1-1/s)]$ for $s>2$.

frechet2 has $a$ known whereas frechet3 estimates it. Estimating $a$ well requires a lot of data and a good choice of ilocation will help speed up convergence. For frechet3 the default linear/additive predictors are $\log(D)$, $\log(b)$, $\log\log(s)$, respectively. It would be great if the first linear/additive predictor was a direct function of the location parameter, but this can run the risk that the estimate is out of range (i.e., greater than min(y)).

References

Castillo, E., Hadi, A. S., Balakrishnan, N. Sarabia, J. S. (2005) Extreme Value and Related Models with Applications in Engineering and Science, Hoboken, N.J.: Wiley-Interscience.

See Also

rfrechet.

Examples

Run this code
y = rfrechet(n <- 1000, shape=exp(exp(0)))
hist(y)
fit2 = vglm(y ~ 1, frechet2, trace=TRUE, maxit=155)
fit3 = vglm(y ~ 1, frechet3(ilocation=0), trace=TRUE, maxit=155)
coef(fit3, matrix=TRUE)
Coef(fit3)
head(fitted(fit3))
mean(y)
head(weights(fit3, type="w"))
vcov(fit3)   # caution needed!
head(fit3@extra$location)  # Estimate of the location parameter
fit3@extra$LHSanchor       # Anchor point
min(y)

Run the code above in your browser using DataLab