[R] R: Equivalence between lm and glm

Stefano Sofia stefano.sofia at regione.marche.it
Fri May 31 17:10:31 CEST 2013


I find difficult to understand why in
lm(log(Y) ~ X)
Y is assumed lognormal.
I know that if Y ~ N then Z=exp(Y) ~ LN, and that if Y ~ LN then Z=log(Y) ~ N.
In
lm(log(Y) ~ X)
I assume Y ~ N(mu, sigma^2), and then exp(Y) would be distributed by a LN, not l
og(Y).
Where is my mistake?

Moreover, in
glm(Y ~ X, family=gaussian(link=log))
the regression is
log(mu) = beta0 + beta1*X.
In
lm(log(Y) ~ X)
the regression is
exp(mu+(1/2)*sigma^2) = beta0 + beta1*X.
Correct?

Thank you for your help
Stefano Sofia


________________________________________
Da: peter dalgaard [pdalgd at gmail.com]
Inviato: mercoledì 29 maggio 2013 18.51
A: Stefano Sofia
Cc: r-help at r-project.org
Oggetto: Re: [R] Equivalence between lm and glm

On May 29, 2013, at 17:23 , Stefano Sofia wrote:

>
> Dear R-users,
> in case of linear model,
> lm(Y ~ X)
> is equivalent to
> glm(Y ~ X, family=gaussian(link=identity))
>
> In case of the exponential model
> lm(log(Y) ~ X)
> why
> glm(Y ~ X, family=gaussian(link=log))
> is not equivalent?

Y is assumed lognormal in one case, normal in the other.

> Is there an equivalent glm to lm(log(Y) ~ X)?
>


Yes, glm(log(Y) ~ X, family=gaussian(link=identity))


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com









________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.


More information about the R-help mailing list