title: How to fit a linear model including the expectation and a transformation
body: <p>I have to fit a linear model for</p>
  
  <pre><code>E(ᴪ(Y)) = β0+ β1X1+ β2X2+ β3X3
  </code></pre>
  
  <p>where ᴪ is a modified Box-Cox transformation  given by:</p>
  
  <p><img src="https://i.stack.imgur.com/BVETE.png" alt=""></p>
  
  <p>and β0,1,2,3 are parameters.
  My data frame is a shown as below which I read into <strong>R</strong> as </p>
  
  <pre><code>data&lt;-read.table("surveydata.txt", header=TRUE)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/jNrZw.png" alt=""></p>
  
  <p>I'm fairly new to <strong>R</strong> and I haven't been able to fit the model. I know how to fit a model using using lm, but wasn't sure how I'll fit it while including the transformation and the expectation.</p>
  
  <p>So far I've tried:</p>
  
  <pre><code>&gt;lm(mean(boxcox(Y))~X1+X2+X3,data)
  Error: $ operator is invalid for atomic vectors
  </code></pre>