Consider a classical mediation setup with three variables: Y is the
dependent variable, X is the predictor, and M is a mediator. For
illustration, we create a toy dataset containing these three variables,
and fit a path analysis model that includes the direct effect of X on Y
and the indirect effect of X on Y via M.
The example illustrates the use of the ":=" operator in the lavaan model
syntax. This operator 'defines' new parameters which take on values that are an
arbitrary function of the original model parameters. The function, however,
must be specified in terms of the parameter labels that are explicitly
mentioned in the model syntax. By default, the standard errors for these
defined parameters are computed by using the so-called Delta method. As with
other models, bootstrap standard errors can be requested simply by specifying
se = "bootstrap" in the fitting function.