title: Predict dependent/endogenous variables from new dataset using lavaan path model in R
body: <p>I have constructed a path model with the R package lavaan (regressions only, no latent variables) using a complete dataset (data1) with values for all variables (x's and y's). The R code I used is as follows:</p>
  <p>Specification:</p>
  <pre><code>model1 &lt;- 'y1 ~ x1 + x2 + x3 + x4 + y2
  y2 ~ x1 + x2 + x4 + x5 + x6'
  </code></pre>
  <p>Fit:</p>
  <pre><code>fit1 &lt;- sem(model = model1, data = data1, estimator = &quot;MLR&quot;)
  </code></pre>
  <p>I now want to <em>predict/estimate</em> values for y1 and y2 using a new dataset (data2) which includes values for all x variables, but not for the y variables. In other words, I want to predict unknown values for the y variables using the known x variable values and my fitted path model estimates, similar to prediction in regular regression.</p>
  <p>However, from my research, the lavPredict() function for lavaan is NOT built to do this (the CRAN description for lavPredict() explicitly states: &quot;the goal of this function is NOT to predict future values of dependent variables as in the regression framework!&quot;; also, <a href="https://github.com/yrosseel/lavaan/issues/44" rel="nofollow noreferrer">here</a>). My understanding is that the regular predict() function will also call lavPredict() for lavaan objects. Though it seems like there were plans to update lavPredict() to be able to conduct regression-style predictions (see <a href="https://groups.google.com/forum/#!topic/lavaan/LPxosJ7lVpU" rel="nofollow noreferrer">here</a>), I cannot find any documentation of these suggested updates being implemented.</p>
  <p><strong>Is there any way to predict (in a regression sense) values for my dependent variables given values of my independent variables from a new dataset using my lavaan path model (as described above)?</strong></p>
  <p>Apologies in advance if I somehow missed the answer to this question elsewhere. Thank you so much!</p>