Skip to content
Prev 309239 / 398506 Next

change lm log(x) to glm poisson

Hi Elaine,

If you want identical models, you need to use the same family and then
the formula is the same.  Here is an example with a built in dataset:


## these two are identical
(Intercept)           hp      log(wt)
 38.86095585  -0.02808968 -13.06001270
(Intercept)           hp      log(wt)
 38.86095585  -0.02808968 -13.06001270

## not identical
(Intercept)          hp          wt
 3.88335638 -0.00173717 -0.20851238

I show the log link because the poisson family default to a log link,
but that is equivalent to:
log(E(y)) = Xb

where X is your design matrix (intercept, A, B, log(C), log(D) for
you).  In short the link function operates on the outcome, not the
predictors so even though the poisson family includes a log link, it
will not yield the same results as a log transformation of two of your
predictors.

I do not have any online references off the top of my head, but it
seems like you may be well served by reading some about generalized
linear models and the concept of link functions.

Cheers,

Josh
On Sun, Oct 28, 2012 at 8:01 PM, Elaine Kuo <elaine.kuo.tw at gmail.com> wrote:
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/