I study computational and quantitative biology with a focus on network aging. This site is to serve as my note-book and to effectively communicate with my students and collaborators. Every now and then, a blog may be of interests to other researchers or teachers. Views in this blog are my own. All rights of research results and findings on this blog are reserved. See also http://youtube.com/c/hongqin
Thursday, August 1, 2019
glm versus lm
I'm not satisfied with the answers here so I'll chime in: the model fit by lm is a special case of the model fit by glm.
lm fits models of the form: Y = XB + e where e~Normal( 0, s2 ).
glm fits models of the form g(Y) = XB + e, where the function g() and the sampling distribution of e need to be specified. The function 'g' is called the "link function". The default link function for glm is the "identity function" such that g(Y) = Y, and the default error distribution is Normal. As you can see, with these defaults glm is fitting the same model fit by lm.
The latter model above is a "generalized" linear model (hence "glm") in that the relationship between the regressors and the target is not strictly linear, but under a transformation (the link function) they are.
The most common glm's are poisson regression and logistic regression. Technically "normal" regression is the most common glm, but we generally don't refer to this as a "generalized" linear model, since it's the primary case upon which the general model is based.
TL;DR: The fact that you're getting the same answer is a good thing. It would be concerning if you weren't.