exponential: Exponential Distribution

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/family.univariate.R

Description

Maximum likelihood estimation for the exponential distribution.

Usage

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

Arguments

link

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) = rate * exp(-rate * (y-A))

for y > A, where A is the known location parameter. By default, A=0. Then E(Y) = A + 1/rate and Var(Y) = 1/rate^2.

Value

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

Note

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

Author(s)

T. W. Yee

References

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

See Also

amlexponential, gpd, laplace, expgeometric, explogff, poissonff, mix2exp, freund61, simulate.vlm, Exponential.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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))

fit.slow <- vglm(y ~ x2 + x3, exponential, data = edata, trace = TRUE)
fit.fast <- vglm(y ~ x2 + x3, exponential(exp = FALSE), data = edata,
                 trace = TRUE, crit = "coef")
coef(fit.slow, mat = TRUE)
summary(fit.slow)


# 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)
Coef(fit.exp)
logLik(fit.exp)

fit.gpd <- vglm(y1 ~ 1, gpd(threshold =  threshold), data = gdata)
coef(fit.gpd, matrix = TRUE)
Coef(fit.gpd)
logLik(fit.gpd)

Example output

Loading required package: stats4
Loading required package: splines

  The decimal point is at the |

  0 | 0000000111111111122222222223333334444445555555566666677778888899
  1 | 000111122222577888899
  2 | 234566678
  3 | 068
  4 | 2
  5 | 
  6 | 15

VGLM    linear loop  1 :  deviance = 111.13669
VGLM    linear loop  2 :  deviance = 106.29222
VGLM    linear loop  3 :  deviance = 106.0252
VGLM    linear loop  4 :  deviance = 106.01939
VGLM    linear loop  5 :  deviance = 106.01927
VGLM    linear loop  6 :  deviance = 106.01927
VGLM    linear loop  7 :  deviance = 106.01927
VGLM    linear loop  1 :  coefficients = 
 0.42193601, -1.22620368,  2.44490723
VGLM    linear loop  2 :  coefficients = 
 0.2016349, -1.1146637,  2.0719245
VGLM    linear loop  3 :  coefficients = 
 0.16456383, -1.08207141,  1.96645208
VGLM    linear loop  4 :  coefficients = 
 0.16335207, -1.08083309,  1.96244178
VGLM    linear loop  5 :  coefficients = 
 0.16335066, -1.08083166,  1.96243708
VGLM    linear loop  6 :  coefficients = 
 0.16335066, -1.08083166,  1.96243708
            loge(rate)
(Intercept)  0.1633506
x2          -1.0808266
x3           1.9624262

Call:
vglm(formula = y ~ x2 + x3, family = exponential, data = edata, 
    trace = TRUE)


Pearson residuals:
              Min      1Q Median     3Q    Max
loge(rate) -2.691 -0.4981 0.2029 0.7055 0.9864

Coefficients: 
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)   0.1634     0.1002   1.630  0.10305    
x2           -1.0808     0.3557  -3.039  0.00238 ** 
x3            1.9624     0.3328   5.896 3.73e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Number of linear predictors:  1 

Name of linear predictor: loge(rate) 

Residual deviance: 106.0193 on 97 degrees of freedom

Log-likelihood: -83.7397 on 97 degrees of freedom

Number of iterations: 7 
            loge(rate)
(Intercept)   1.496169
    rate 
4.464551 
[1] 1488.506
            loge(scale) logoff(shape, offset = 0.5)
(Intercept)   -1.487505                  -0.7106998
       scale        shape 
 0.225935730 -0.008699738 
[1] 1488.613

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.