title: How do you perform mediation analysis with multiple treatments in R
body: <p>I would like to analyze data from an experiment using mediation analysis in R.  However, the experimental design is a full factorial design across three variables (two continuous, one categorical) and I cannot find an explanation of how to implement mediation in R with multiple treatments.  I have read the documentation on the <code>mediation</code> package but they do not appear to provide ways of expanding <code>X</code> beyond a single treatment.  Similarly, I cannnot find a way to do that in <code>MBESS</code> or <code>lavaan</code> packages.  </p>
  
  <p>I found a very recent article that discusses the statistical theory/approaches necessary to implement multiple treatments in mediation analysis, Hayes and Preacher 2014 (<a href="http://quantpsy.org/pubs/hayes_preacher_2014.pdf" rel="noreferrer">http://quantpsy.org/pubs/hayes_preacher_2014.pdf</a>) but, unfortunately, they only give code implementations of their approach in Mplus, SPSS and SAS.  I need to implement this in the next couple days for a presentation so I don't have time to get up to speed on another program to do it, I need to implement it in R.</p>
  
  <p>Does anyone know if there is an implementation in R that I've missed?
  Or if there is a way to implement this approach outside of a package?</p>
  
  <p>(I realize I could convert my full factorial design into a single treatment by treating each 3-factor combination as a level but such an analysis would not be helpful.)</p>