In R, I am using the bc
function to do a box-cox transformation. What factors do I need to consider when setting p
(the power argument)?
2 Answers
$\begingroup$
$\endgroup$
I've found that I can use the following to get a transformation that best approximates a normal distribution:
library(geoR)
bc(x=vecToTransform, p=boxcoxfit(y)$lambda)
$\begingroup$
$\endgroup$
3
If this is on a single variable, a likelihood profile wrt p
is typically used, as in Wikipedia example. Note that you need to use the right scale with geometric means of your variable and such for it to make sense.
-
1$\begingroup$ Thanks. What do you mean by "Note that you need to use the right scale with geometric means of your variable and such for it to make sense." How can I implement this? $\endgroup$ Commented May 29, 2012 at 23:16
-
1$\begingroup$ Box-Cox transformation is not just $x^\lambda$, it is $\lambda\frac{x^\lambda - 1}{\dot x^{\lambda-1}}$ where $\dot x$ is the geometric mean. The reason for introducing this geometric mean is to provide correct likelihood ratio tests. $\endgroup$– StasKCommented May 30, 2012 at 1:27
-
$\begingroup$ @StasK: Can you provide a reference for your claim? $\endgroup$ Commented Feb 25, 2017 at 14:11
scale
to get standard scores, I'm transforming these measures $\endgroup$