Hello, Thanks for the book list. Some are added.
- Faraway. 2006. Extending the Linear Model With R: Generalized Linear, Mixed Effects and Nonparametric Regression Models (Texts in Statistical Science). - Venables and Ripley. 2002. Modern Applied Statistics with S (4th ed.). (Chapter 7) - Crawley. 2005. Statistics: An Introduction using R. (Chapter 13) On Mon, Oct 29, 2012 at 11:35 AM, Mark Leeds <marklee...@gmail.com> wrote: > Hi Josh and Elaine: John Fox's CAR book ( the companion to his applied > regression text ) is really great for implementing GLMs in R. It also has a > brief but quality discussion of the theory > behind them. His text goes into more detail. Dobson's "Introduction to > generalized linear models" is also decent. So is Faraway's text but I don't > remember the title. > > > Mark > > > > > > > > > On Sun, Oct 28, 20 > 12 at 11:25 PM, Joshua Wiley <jwiley.ps...@gmail.com> wrote: > >> 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 >> > coef(lm(mpg ~ hp + log(wt), data = mtcars)) >> (Intercept) hp log(wt) >> 38.86095585 -0.02808968 -13.06001270 >> > coef(glm(mpg ~ hp + log(wt), data = mtcars, family = gaussian)) >> (Intercept) hp log(wt) >> 38.86095585 -0.02808968 -13.06001270 >> >> ## not identical >> > coef(glm(mpg ~ hp + wt, data = mtcars, family = gaussian(link = "log"))) >> (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...@gmail.com> >> wrote: >> > >> > Hello list, >> > >> > I am running a regression using >> > >> > lm(Y~A+B+log(C)+log(D)) >> > >> > >> > Now, I would like to test if glm can produce similar results. >> > So the code was revised as >> > >> > glm(Y~A+B+C+D, family=poisson) (code 1) >> > >> > >> > However, I found some example using glm for lm. >> > It suggests that the code should be revised like >> > glm(Y~A+B+log(C)+log(D), family=poisson) (code 2) >> > >> > Please kindly advise which code is correct. >> > Thank you. >> > >> > Elaine >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> >> >> >> >> -- >> Joshua Wiley >> Ph.D. Student, Health Psychology >> Programmer Analyst II, Statistical Consulting Group >> University of California, Los Angeles >> https://joshuawiley.com/ >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.