title: How to build and test multiple models in R
body: <p>Suppose I have a dataset like (forget about the distribution):</p>
  
  <pre><code>modData &lt;- data.frame("A" = rnorm(20, 15, 3),
                        "B" = rnorm(20, 20, 3),
                        "C" = rnorm(20, 25, 3),
                        "X" = rnorm(20, 5, 1)
                        )
  </code></pre>
  
  <p>If I use <code>X</code> as a predictor, <code>A</code>, <code>B</code>and <code>C</code> as responses, respectively:</p>
  
  <pre><code>md1 &lt;- lm(A ~ X, data = modData)
  md2 &lt;- lm(B ~ X, data = modData)
  md3 &lt;- lm(C ~ X, data = modData)
  </code></pre>
  
  <p>Then do a Shapiro test and a boxcox test to every model, e.g. :</p>
  
  <pre><code>shapiro.test(residuals(md1))
  boxcox(md1, plotit = T)
  </code></pre>
  
  <p>Is there a convenient way to build and test multiple models without manually typing each of them?</p>