5
$\begingroup$

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)?

$\endgroup$
2
  • 2
    $\begingroup$ The answer varies according to your reason for considering the transformation: whether it is for exploratory or confirmatory purposes, whether it is a dependent or independent variable in a regression, and so on. Could you perhaps share some of that relevant information with us so we can give you appropriate, focused answers? $\endgroup$
    – whuber
    Commented May 30, 2012 at 1:15
  • $\begingroup$ It's for exploratory purposes. I'd like to transform certain measures of an event into a comparable space for clustering (euclidean distance perhaps?). In order to get a roughly normal distribution in order to use scale to get standard scores, I'm transforming these measures $\endgroup$ Commented May 30, 2012 at 8:32

2 Answers 2

3
$\begingroup$

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)
$\endgroup$
2
$\begingroup$

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.

$\endgroup$
3
  • 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$
    – StasK
    Commented May 30, 2012 at 1:27
  • $\begingroup$ @StasK: Can you provide a reference for your claim? $\endgroup$ Commented Feb 25, 2017 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.