I have a conceptual concern about data tranformation and R^2. Often we transform data to respect the assumption of the linear model. Therefore, we can use multiple type of transformation such as log and square root. When the data contain zero and we find that the log transformation is the most suitable then we need to add a value to be able to transform it in log since log of zero is - Inf.
So we try to add a value that won't affect the result of our relationship. My problem is here that if I had value to my data set, the bigger it is , the higher is the R squared.
Here an example
x<-c(10,20,0,30,40,10,0,1,8,56) y<-c(5.6,7.3,0,6.5,8.9,0,0.1,2,4.5,10.6) modelz<-lm(y~x) summary(modelz)
The square root transformation always give a higher R squared. Somebody know why ?( might be a stupid question sorry for that)
modelzsq<-lm(sqrt(y)~sqrt(x)) summary(modelzsq) modelzlog<-lm(log10(y+0.1)~log10(x+0.1)) summary(modelzlog) modelzlog2<-lm(log10(y+0.05)~log10(x+0.05)) summary(modelzlog2) modelzlog3<-lm(log10(y+0.2)~log10(x+0.2)) summary(modelzlog3)
So if you notice, the modelzlog3 has a higher R squared than the two other log transform models. Therefore, I think the reason for that is that smaller value when transform in log10 are more negative .
For example log(0.1) give -1 and log(0.01) is -2 . So The bigger is the vaue the closest is the value to the other one (all positive value), this explain why the R squared is higher with bigger value I think...
My question is: I am doing model selection base on AIC but I can't compare different data transform model(see AIC equation...) so do I select model only base on the respect of the assumptions and the biological sense of the transformation ? Like "y" would be rodent density and a value of 0.1 would be the density value when we catch only one rodent so the minimal density that can be obersved.
Thanks a lot for your advice !