What is the primary reason that someone would apply the square root transformation to their data? I always observe that doing this always increases the $R^2$. However, this is probably just due to centering the data. Any thoughts are appreciated!
-
$\begingroup$ I have answered this question and the more general question here stats.stackexchange.com/questions/18844/… $\endgroup$– IrishStatCommented Aug 17, 2015 at 17:40
-
3$\begingroup$ If the dependent variable is different, the R-squares cannot be compared. $\endgroup$– user105305Commented Feb 16, 2016 at 9:40
5 Answers
In general, parametric regression / GLM assume that the relationship between the $Y$ variable and each $X$ variable is linear, that the residuals once you've fitted the model follow a normal distribution and that the size of the residuals stays about the same all the way along your fitted line(s). When your data don't conform to these assumptions, transformations can help.
It should be intuitive that if $Y$ is proportional to $X^2$ then square-rooting $Y$ linearises this relationship, leading to a model that better fits the assumptions and that explains more variance (has higher $R^2$). Square rooting $Y$ also helps when you have the problem that the size of your residuals progressively increases as your values of $X$ increase (i.e. the scatter of data points around the fitted line gets more marked as you move along it). Think of the shape of a square root function: it increases steeply at first but then saturates. So applying a square root transform inflates smaller numbers but stabilises bigger ones. So you can think of it as pushing small residuals at low $X$ values away from the fitted line and squishing large residuals at high $X$ values towards the line. (This is mental shorthand not proper maths!)
As Dmitrij and ocram say, this is just one possible transformation which will help in certain circumstances, and tools like the Box-Cox formula can help you to pick the most useful one. I would advise getting into the habit of always looking at a plots of residuals against fitted values (and also a normal probability plot or histogram of residuals) when you fit a model. You'll find you'll often end up being able to see from these what sort of transformation will help.
-
1$\begingroup$ Hey Thanks! I know the boxcox funtion, but I was wondering for what practical reasons the sqrt transformation makes sense! Thank you! $\endgroup$ Commented May 30, 2011 at 16:47
-
1$\begingroup$ if the variance of the errors is linearly related to the level of the series one takes a logarithmic transformation. If the standard deviation is linearly related to the level of the series one takes a square root transformation. The selection has nothing to do with the size of the residuals as it relates to the level of y and all to do with the coupling/de-coupling the first and second moment. $\endgroup$ Commented May 30, 2011 at 17:58
-
1$\begingroup$ Freya, +1 for mental shorthand >> proper maths. Is that intuition also a reason for using L.5-metrics-for-clustering ? $\endgroup$– denisCommented Jun 14, 2011 at 17:17
-
$\begingroup$ Hi Denis, I'm afraid I don't know anything about clustering. $\endgroup$ Commented Jun 15, 2011 at 13:22
The square-root transformation is just a special case of Box-Cox power transformation (a nice overview by Pengfi Li, could be useful reading and is found here), with $\lambda = 0.5$ and omitting some centering.
The aim of the Box-Cox transformations is to ensure the usual assumptions for Linear Model hold. That is, $y\sim N(X\beta, \sigma^2 I_n)$.
However this a priori fixed value could be (and probably is) not optimal. In R you may consider a function from car
library powerTransform
that helps to estimate an optimal value for Box-Cox transformations for each of the variables participated in linear regression or any data you work with (see the example(powerTransform)
for further details).
When the variable follows a Poisson distribution, the results of the square root transform will be much closer to Gaussian.
-
$\begingroup$ Could you give some arguments for this claim? $\endgroup$ Commented May 6, 2013 at 5:33
-
$\begingroup$ It doesnt really help much for the individual distribution with a specific value of the parameter, but it makes the family of distribution obtained when the parameter is varying, closer to a normal family with constant variance $\endgroup$ Commented Jun 24, 2015 at 20:06
-
1$\begingroup$ See en.wikipedia.org/wiki/Anscombe_transform $\endgroup$ Commented Apr 24, 2018 at 6:58
Taking the square root is sometimes advocated to make a non-normal variable appear like a normal variable in regression problems. The logarithm is another common possible transformation.
Distance matrix calculated with Bray-Curtis are usually not metric for some data, giving rise to negative eigenvalues. One of the solutions to overcome this problem is to transform (logarithmic, Square root or double Square root) it.