# Residuals as indication of transformation of data

In R I have data and I want to make a regression analysis, finding a function that can fit the data. So head(data) gives

promotion   new_users
39.5              100
36.1               79
0.0               18


To find the optimal regression function that fitted data I plot the residuals of the regression model to see if the residuals are systematic close the zero line. But I do not know which transformation is the best one to use. Here I tried to do linear transformation, sqrttransformation and finally log-transformation.

lm.linear = lm(formula= data$new_users ~ data$promotion )
plot(resid(lm.linear), col="blue")


lm.sqrt = lm(formula= data$new_users ~ sqrt(data$promotion) )
plot(resid(lm.sqrt), col="blue")


lm.log = lm(formula= data$new_users ~ log(0.1+data$promotion ))
plot(resid(lm.log), col="blue")


If I simply just plot the data and the fitted regression function I can't see which regression function fittest the data best because they are very similar. Which transformation is the best one and is there another way to find out what is the best transformation ?

Thanks.

I did quantile regression as well. So on the plot here we see that the quantile regression estimate don't differ from the regular regression estimate in the area between the 2 red lines. So I can use this to chose a value for my estimate say 0.6 in the first plot and 0.5 in the second plot as parameters for my regular regression model.

So to justify the use of quantile I make the Breusch-Pagan test:

library(lmtest)
bptest(formula=data$new_users ~ data$promotion , data=data)


and this gives us a very low p-value. Now a low p-value is the same as saying that the Breusch-Pagan test statistic is significantly different from zero, therefore we have heteroscedasticity and are justified in the use of quantile regression. Is this not correct?

• When using linear regression you DO NOT impose any distributional assumptions on the residuals. – Repmat May 17 '16 at 12:38
• And that is not a problem. I already tested if data is normal distr. but it's not so it's just non-parametric analysis. – Ole Petersen May 17 '16 at 13:12
• Well its still a highly parametric model, loaded with parametric assumptions. – Repmat May 17 '16 at 15:31