lgammaff.RdEstimation of the parameter of the standard and nonstandard log-gamma distribution.
lgamma1(lshape = "loglink", ishape = NULL)
lgamma3(llocation = "identitylink", lscale = "loglink",
lshape = "loglink", ilocation = NULL, iscale = NULL, ishape = 1,
zero = c("scale", "shape"))Parameter link function applied to the
location parameter \(a\)
and the positive scale parameter \(b\).
See Links for more choices.
Parameter link function applied to
the positive shape parameter \(k\).
See Links for more choices.
Initial value for \(k\). If given, it must be positive. If failure to converge occurs, try some other value. The default means an initial value is determined internally.
Initial value for \(a\) and \(b\). The defaults mean an initial value is determined internally for each.
An integer-valued vector specifying which
linear/additive predictors are modelled as intercepts only.
The values must be from the set {1,2,3}.
The default value means none are modelled as intercept-only terms.
See CommonVGAMffArguments for more information.
The probability density function of the standard log-gamma
distribution is given by
$$f(y;k)=\exp[ky - \exp(y)] / \Gamma(k),$$
for parameter \(k>0\) and all real \(y\).
The mean of \(Y\) is digamma(k) (returned as
the fitted values) and its variance is trigamma(k).
For the non-standard log-gamma distribution, one replaces \(y\)
by \((y-a)/b\), where \(a\) is the location parameter
and \(b\) is the positive scale parameter.
Then the density function is
$$f(y)=\exp[k(y-a)/b - \exp((y-a)/b)] / (b \, \Gamma(k)).$$
The mean and variance of \(Y\) are a + b*digamma(k)
(returned as
the fitted values) and b^2 * trigamma(k), respectively.
An object of class "vglmff"
(see vglmff-class).
The object is used by modelling functions
such as vglm,
and vgam.
Kotz, S. and Nadarajah, S. (2000). Extreme Value Distributions: Theory and Applications, pages 48–49, London: Imperial College Press.
Johnson, N. L. and Kotz, S. and Balakrishnan, N. (1995). Continuous Univariate Distributions, 2nd edition, Volume 2, p.89, New York: Wiley.
The standard log-gamma distribution can be viewed as a generalization of the standard type 1 extreme value density: when \(k = 1\) the distribution of \(-Y\) is the standard type 1 extreme value distribution.
The standard log-gamma distribution is fitted with lgamma1
and the non-standard (3-parameter) log-gamma distribution is
fitted with lgamma3.
ldata <- data.frame(y = rlgamma(100, shape = exp(1)))
fit <- vglm(y ~ 1, lgamma1, ldata, trace = TRUE, crit = "coef")
#> Iteration 1: coefficients = 0.89067759
#> Iteration 2: coefficients = 0.92236538
#> Iteration 3: coefficients = 0.9224699
#> Iteration 4: coefficients = 0.9224699
summary(fit)
#>
#> Call:
#> vglm(formula = y ~ 1, family = lgamma1, data = ldata, trace = TRUE,
#> crit = "coef")
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 0.92247 0.05698 16.19 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Name of linear predictor: loglink(shape)
#>
#> Log-likelihood: -113.6391 on 99 degrees of freedom
#>
#> Number of Fisher scoring iterations: 4
#>
#> No Hauck-Donner effect found in any of the estimates
#>
coef(fit, matrix = TRUE)
#> loglink(shape)
#> (Intercept) 0.9224699
Coef(fit)
#> shape
#> 2.515496
ldata <- data.frame(x2 = runif(nn <- 5000)) # Another example
ldata <- transform(ldata, loc = -1 + 2 * x2, Scale = exp(1))
ldata <- transform(ldata, y = rlgamma(nn, loc, sc = Scale, sh = exp(0)))
fit2 <- vglm(y ~ x2, lgamma3, data = ldata, trace = TRUE, crit = "c")
#> Iteration 1: coefficients =
#> -1.45936415, 1.16212337, 0.19172302, 1.72745129
#> Iteration 2: coefficients =
#> -1.267101646, 1.056979534, 0.082088825, 2.049779064
#> Iteration 3: coefficients =
#> -1.059054370, 1.006670755, 0.011251028, 2.076384759
#> Iteration 4: coefficients =
#> -1.0422567728, 1.0005824994, 0.0027422466, 2.0815295492
#> Iteration 5: coefficients =
#> -1.0401193218, 1.0000875843, 0.0019974207, 2.0821083940
#> Iteration 6: coefficients =
#> -1.0399548089, 1.0000525843, 0.0019432071, 2.0821525944
#> Iteration 7: coefficients =
#> -1.0399429064, 1.0000500765, 0.0019393177, 2.0821556926
#> Iteration 8: coefficients =
#> -1.0399420578, 1.0000498977, 0.0019390402, 2.0821559151
#> Iteration 9: coefficients =
#> -1.0399419972, 1.0000498849, 0.0019390204, 2.0821559309
#> Iteration 10: coefficients =
#> -1.039941993, 1.000049884, 0.001939019, 2.082155932
#> Iteration 11: coefficients =
#> -1.0399419926, 1.0000498839, 0.0019390189, 2.0821559322
coef(fit2, matrix = TRUE)
#> location loglink(scale) loglink(shape)
#> (Intercept) -1.039942 1.00005 0.001939019
#> x2 2.082156 0.00000 0.000000000