Estimates the 1-parameter gamma distribution by maximum likelihood estimation.

gamma1(link = "loglink", zero = NULL, parallel = FALSE,
       type.fitted = c("mean", "percentiles", "Qlink"),
       percentiles = 50)

Arguments

Link function applied to the (positive) shape parameter. See Links for more choices and general information.

zero, parallel

Details at CommonVGAMffArguments.

type.fitted, percentiles

See CommonVGAMffArguments for information. Using "Qlink" is for quantile-links in VGAMextra.

Details

The density function is given by $$f(y) = \exp(-y) \times y^{shape-1} / \Gamma(shape)$$ for \(shape > 0\) and \(y > 0\). Here, \(\Gamma(shape)\) is the gamma function, as in gamma. The mean of \(Y\) (returned as the default fitted values) is \(\mu=shape\), and the variance is \(\sigma^2 = shape\).

Value

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

References

Most standard texts on statistical distributions describe the 1-parameter gamma distribution, e.g.,

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

This VGAM family function can handle a multiple responses, which is inputted as a matrix.

The parameter \(shape\) matches with shape in rgamma. The argument rate in rgamma is assumed 1 for this family function, so that scale = 1 is used for calls to dgamma, qgamma, etc.

If \(rate\) is unknown use the family function gammaR to estimate it too.

See also

gammaR for the 2-parameter gamma distribution, lgamma1, lindley, simulate.vlm, gammaff.mm.

Examples

gdata <- data.frame(y = rgamma(n = 100, shape = exp(3)))
fit <- vglm(y ~ 1, gamma1, data = gdata, trace = TRUE, crit = "coef")
#> Iteration 1: coefficients = 3.0699161
#> Iteration 2: coefficients = 3.0234414
#> Iteration 3: coefficients = 3.0234671
#> Iteration 4: coefficients = 3.0234671
coef(fit, matrix = TRUE)
#>             loglink(shape)
#> (Intercept)       3.023467
Coef(fit)
#>    shape 
#> 20.56246 
summary(fit)
#> 
#> Call:
#> vglm(formula = y ~ 1, family = gamma1, data = gdata, trace = TRUE, 
#>     crit = "coef")
#> 
#> Coefficients: 
#>             Estimate Std. Error z value Pr(>|z|)    
#> (Intercept)  3.02347    0.02179   138.8   <2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Name of linear predictor: loglink(shape) 
#> 
#> Log-likelihood: -291.1479 on 99 degrees of freedom
#> 
#> Number of Fisher scoring iterations: 4 
#> 
#> No Hauck-Donner effect found in any of the estimates
#>