[R] AIC, glm, lognormal distribution

Bill.Venables@csiro.au Bill.Venables at csiro.au
Mon Dec 13 04:18:12 CET 2004


Benjamin,

A couple of points:

> fit <- glm(y ~ x, gaussian(link = "log"))

does NOT fit a model with a lognormal response distribution.  It fits a
non-linear regression model with an ordinary gaussian response
distribution.  This model has constant variance, whereas the lognormal
model (which you would fit by transforming the response) has constant
coefficient of variation.  You would transform the response for two
reasons, namely it should linearize the relationship between
(transformed) response and predictors AND it should change a constant CV
into homoscedasticity, or constant variance.  This latter property as
important as the first, usually.  You should not think of a glm with log
link as a kind of handy alternative to a log-transformed regression as
they are in reality very different models.

Second point: you claim that the calls

> fitA <- glm(y ~ x, gaussian(link = "log"))
> fitB <- glm(y ~ x, gaussian)
> fitC <- lm(y ~ x)

give identical results.  This is NOT true for me on R 2.0.1 (Windows),
so you may care to check that, (although fitB and fitC are fully
equivalent, of course).

When you sort out the model you really need to use, you may find stepAIC
in the MASS library useful as one tool for model selection, or at least
for steps towards that generally rather complex goal.

Bill Venables.

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Benjamin M.
Osborne
Sent: Monday, 13 December 2004 12:40 PM
To: r-help at stat.math.ethz.ch
Subject: [R] AIC, glm, lognormal distribution


I'm attempting to do model selection with AIC, using a glm and a
lognormal
distribution, but:

fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian(link="log"))

## gives the same result as either of the following:
fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian)
fit1<-lm(BA~Year,data=pdat.sp1.65.04)

fit1
#Coefficients:
#(Intercept)     Year2004
#    -1.6341      -0.2741

#Degrees of Freedom: 84 Total (i.e. Null);  83 Residual
#Null Deviance:      1.521
#Residual Deviance: 1.476        AIC: -97.31


fit1<-glm(BA~Year,data=pdat.sp1.65.04, family=quasi(link="log"))
# also gives the same result but returns AIC: NA


## Is it possible to model a lognormal distribution without having to
transform
## the data themselves?  (i.e.:

fit1<-lm(log(BA)~Year,data=pdat.sp1.65.04)



Thanks in advance,
Ben Osborne

--
Botany Department
University of Vermont
109 Carrigan Drive
Burlington, VT 05405

benjamin.osborne at uvm.edu
phone: 802-656-0297
fax: 802-656-0440

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list