[R] Odp: Syntax in taking log to transfrom the data to fit Gaussian distribution

Petr PIKAL petr.pikal at precheza.cz
Tue Feb 24 11:59:19 CET 2009


Petr Pikal
petr.pikal at precheza.cz
724008364, 581252140, 581252257


r-help-bounces at r-project.org napsal dne 24.02.2009 11:46:07:

> 
> Hi,
> 
> I have a data set (weight) that does not follow the Gaussian (Normal)
> distribution. However, I have to transform the data before applying the
> Gaussian distribution. I used this syntax and used log(weight) as:
> posJy.model<-glm(log(weight) ~ factor(pos),
> family=gaussian(link='identity'), subset=Soil=="Jy"). This syntax COULD 
NOT
> transform the data. But if I transform the data before applying the 
model,

Without going too much into details, there is nothing wrong in log inside 
formula
try

summary(glm(lot1 ~ log(u), data=clotting, family=Gamma))
summary(glm(log(lot1) ~ log(u), data=clotting, family=Gamma))

> then it works. The syntax is: 
> 
> weight<-log(weight)
> posJy.model<-glm(weight ~ factor(pos), family=gaussian(link='identity'),
> subset=Soil=="Jy")
> 
> 
> What is wrong with the first syntax. 

AFAIK, nothing

Regards
Petr

I have seen many scripts that the R
> users have applied any function (log, -, ...) directly inside the
> formulation. 
> 
> It will help me to understand the grammar of R.
> 
> Thank you.
> Saeed
> 
> 
> 
> 
> -- 
> View this message in context: 
http://www.nabble.com/Syntax-in-taking-log-to-
> transfrom-the-data-to-fit-Gaussian-distribution-tp22179656p22179656.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