Masayoshi Hayashi
2003-Jun-10 15:31 UTC
[R] fitting data to exponential distribution with glm
I am learning glm function, but how do you fit data using exponential distribution with glm? In the help file, under "Family Objects for Models", no ready made option seems available for the distribution as well as for other distributions satisfying GLM requirements not listed there.
Adelchi Azzalini
2003-Jun-10 15:47 UTC
[R] fitting data to exponential distribution with glm
On Tuesday 10 June 2003 17:31, Masayoshi Hayashi wrote:> I am learning glm function, but how do you fit data using exponential > distribution with glm?The Gamma family is parametrised in glm() by two parameters: mean and dispersion; the "dispersion" regulates the shape. So must fit a GLM with the Gamma family, and then produce a "summary" with dispersion parameter set equal to 1, since this value corresponds to the exponential distribution in the Gamma family. In practice: fit <- glm(formula =..., family = Gamma) summary(fit,dispersion=1) best wishes, Adelchi Azzalini -- Adelchi Azzalini <azzalini at stat.unipd.it> Dipart.Scienze Statistiche, Universit? di Padova, Italia http://azzalini.stat.unipd.it/
Prof Brian Ripley
2003-Jun-10 15:52 UTC
[R] fitting data to exponential distribution with glm
An exponential distribution is a gamma distribution, and as far as fitting the MLE of the coefficients all gammas give the same MLEs. (You can specify the dispersion and hence that the gamma is exponential when asking for summaries, anova, etc.) On Wed, 11 Jun 2003, Masayoshi Hayashi wrote:> I am learning glm function, but how do you fit data using exponential > distribution with glm? > In the help file, under "Family Objects for Models", no ready made option > seems available for the distribution as well as for other distributions > satisfying GLM requirements not listed there.Which ones did you have in mind? The only other commonly used distribution which gives a glm is the negative binomial with fixed shape, for which see the MASS book and package. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595