Maximum likelihood estimation for the exponential distribution.

exponential(link = "loglink", location = 0, expected = TRUE,
            type.fitted = c("mean", "percentiles", "Qlink"),
            percentiles = 50,
            ishrinkage = 0.95, parallel = FALSE, zero = NULL)

Arguments

Parameter link function applied to the positive parameter \(rate\). See Links for more choices.

location

Numeric of length 1, the known location parameter, \(A\), say.

expected

Logical. If TRUE Fisher scoring is used, otherwise Newton-Raphson. The latter is usually faster.

ishrinkage, parallel, zero

See CommonVGAMffArguments for information.

type.fitted, percentiles

See CommonVGAMffArguments for information.

Details

The family function assumes the response \(Y\) has density $$f(y) = \lambda \exp(-\lambda (y-A))$$ for \(y > A\), where \(A\) is the known location parameter. By default, \(A=0\). Then \(E(Y) = A + 1/ \lambda\) and \(Var(Y) = 1/ \lambda^2\).

Value

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

References

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.

Author

T. W. Yee

Note

Suppose \(A = 0\). For a fixed time interval, the number of events is Poisson with mean \(\lambda\) if the time between events has a geometric distribution with mean \(\lambda^{-1}\). The argument rate in exponential is the same as rexp etc. The argument lambda in rpois is somewhat the same as rate here.

Examples

edata <- data.frame(x2 = runif(nn <- 100) - 0.5)
edata <- transform(edata, x3 = runif(nn) - 0.5)
edata <- transform(edata, eta = 0.2 - 0.7 * x2 + 1.9 * x3)
edata <- transform(edata, rate = exp(eta))
edata <- transform(edata, y = rexp(nn, rate = rate))
with(edata, stem(y))
#> 
#>   The decimal point is at the |
#> 
#>   0 | 00000000001111111111112222222233333333344444444455555666667888888899
#>   1 | 111122344566788
#>   2 | 0123466
#>   3 | 469
#>   4 | 02
#>   5 | 
#>   6 | 
#>   7 | 
#>   8 | 1
#> 

fit.slow <- vglm(y ~ x2 + x3, exponential, data = edata, trace = TRUE)
#> Iteration 1: deviance = 131.89819
#> Iteration 2: deviance = 128.14608
#> Iteration 3: deviance = 128.05522
#> Iteration 4: deviance = 128.05496
#> Iteration 5: deviance = 128.05496
fit.fast <- vglm(y ~ x2 + x3, exponential(exp = FALSE), data = edata,
                 trace = TRUE, crit = "coef")
#> Iteration 1: coefficients = 
#>  0.6460197, -1.1990895,  2.5411612
#> Iteration 2: coefficients = 
#>  0.40326186, -0.99750891,  1.98503817
#> Iteration 3: coefficients = 
#>  0.34045523, -0.91758530,  1.78525925
#> Iteration 4: coefficients = 
#>  0.33582307, -0.91157421,  1.77067002
#> Iteration 5: coefficients = 
#>  0.33580009, -0.91154499,  1.77059908
#> Iteration 6: coefficients = 
#>  0.33580009, -0.91154499,  1.77059907
coef(fit.slow, mat = TRUE)
#>             loglink(rate)
#> (Intercept)     0.3357996
#> x2             -0.9115381
#> x3              1.7705873
summary(fit.slow)
#> 
#> Call:
#> vglm(formula = y ~ x2 + x3, family = exponential, data = edata, 
#>     trace = TRUE)
#> 
#> Coefficients: 
#>             Estimate Std. Error z value Pr(>|z|)    
#> (Intercept)   0.3358     0.1008   3.331 0.000865 ***
#> x2           -0.9115     0.3181  -2.866 0.004158 ** 
#> x3            1.7706     0.3353   5.280 1.29e-07 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Name of linear predictor: loglink(rate) 
#> 
#> Residual deviance: 128.055 on 97 degrees of freedom
#> 
#> Log-likelihood: -73.0496 on 97 degrees of freedom
#> 
#> Number of Fisher scoring iterations: 5 
#> 
#> No Hauck-Donner effect found in any of the estimates
#> 


# Compare results with a GPD. Has a threshold.
threshold <- 0.5
gdata <- data.frame(y1 = threshold + rexp(n = 3000, rate = exp(1.5)))

fit.exp <- vglm(y1 ~ 1, exponential(location = threshold), data = gdata)
coef(fit.exp, matrix = TRUE)
#>             loglink(rate)
#> (Intercept)      1.506818
Coef(fit.exp)
#>    rate 
#> 4.51235 
logLik(fit.exp)
#> [1] 1520.454

fit.gpd <- vglm(y1 ~ 1, gpd(threshold =  threshold), data = gdata)
coef(fit.gpd, matrix = TRUE)
#>             loglink(scale) logofflink(shape, offset = 0.5)
#> (Intercept)      -1.504118                      -0.6985687
Coef(fit.gpd)
#>        scale        shape 
#>  0.222213165 -0.002703437 
logLik(fit.gpd)
#> [1] 1520.465