title: how to use the Box-Cox power transformation in R
body: <p>I need to transform some data into a 'normal shape' and I read that Box-Cox can identify the exponent to use to transform the data.</p>
  
  <p>For what I understood </p>
  
  <pre><code>car::boxCoxVariable(y)
  </code></pre>
  
  <p>is used for response variables in linear models, and</p>
  
  <pre><code>MASS::boxcox(object)
  </code></pre>
  
  <p>for a formula or fitted model object. So, because my data are the variable of a dataframe, the only function I found I could use is:</p>
  
  <pre><code>car::powerTransform(dataframe$variable, family="bcPower")
  </code></pre>
  
  <p>Is that correct? Or am I missing something?</p>
  
  <p>The second question is about what to do after I obtain the</p>
  
  <pre><code>Estimated transformation parameters
  dataframe$variable
  0.6394806
  </code></pre>
  
  <p>Should I simply multiply the <em>variable</em> by this value?
  I did so:</p>
  
  <pre><code>aaa = 0.6394806
  dataframe$variable2 = (dataframe$variable)*aaa
  </code></pre>
  
  <p>and then I run the shapiro-wilks test for normality, but again my data don't seem to follow a normal distribution:</p>
  
  <pre><code>shapiro.test(dataframe$variable2)
  data:  dataframe$variable2
  W = 0.97508, p-value &lt; 2.2e-16
  </code></pre>