[R] please help! what are the different using log-link function and log transformation?
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Sun Jun 19 14:36:04 CEST 2011
The two commands you give below are certain to lead to very different results, because they are fitting very different models.
The first is a gaussian model for the response with a log link, and constant variance.
The second is a gaussian model for a log-transformed response and identity link. On the original scale this model would imply a constant coefficient of variation and hence a variance proportional to the square of the mean, and not constant.
Your problem is not particularly an R issue, but a difficulty with understanding generalized linear models (and hence generalized additive models, which are based on them).
Bill Venables.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of pigpigmeow [glorykwok at hotmail.com]
Sent: 19 June 2011 17:39
To: r-help at r-project.org
Subject: [R] please help! what are the different using log-link function and log transformation?
I'm new R-programming user, I need to use gam function.
y <- gam(a ~ s(b), family = gaussian(link=log), data)
y <- gam(log(a) ~ s(b), family = gaussian (link=identity), data)
why [do] these two command [give different] results?
I guess these two command results are same, but actally these two command
results are different, Why?
--
View this message in context: http://r.789695.n4.nabble.com/please-help-what-are-the-different-using-log-link-function-and-log-transformation-tp3608931p3608931.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at 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.
More information about the R-help
mailing list