# Box-Cox transformation in R [closed]

I am relatively new to R and I am interested in performing a Box-Cox transformation. However, I am a little lost as to the step-by-step process of doing this. I have been searching the web for a number of days and have tried various code to no avail.

Overall, within my dataset (data=fw) I want to test for differences in a dependent variable (x) between between two locations (north and south). However, my data is not normally distributed and has unequal variance. Therefore, I need to transform my data (log and square root have not worked). Is the 'MASS' package the only package that I need to use to perform the Box-Cox transformation, or do I need some others? Any advice on the step-by-step process on Box-Cox transformation of the data would be much appreciated.

• Read the manual ?boxcox, & see Faraway (2002), Practical Regression and Anova using R, Ch.8 for some examples. – Scortchi - Reinstate Monica Jan 19 '15 at 10:40
• Your data need NOT necessarily be normal to apply a model. Only your residual from the model should be normal. even if your residual are non normal, This could be caused by outliers and other anomalies. Even after correcting for outliers if your residuals are non normal then you could use an appropriate box-cox transformation. – forecaster Jan 19 '15 at 11:37
• I think this may be off-topic because it is about how to use R without a reproducible example. – gung - Reinstate Monica Jan 19 '15 at 13:57

For more details on performing Box-Cox transformation in R, check this excellent discussion. In addition to MASS package, some other R packages can be used for Box-Cox transformation, also consider using car package, which offers several types of power transformations and somewhat more general than in MASS functions, for example this one.
In regard to selecting the optimal parameter for the transformation, see this answer on StackOverflow as well as the AID R package (see page on CRAN).