I would like to use semTools to examine several indirect effects. However, some predictors have nonlinear relationships (i.e., quadratic) with the mediators, but I found very little information online about the codes for this.
I've tried to specify the nonlinear indirect effect using the codes below.
M is the mediator; X is the predictor; X_SQ is the squared variable of X (i.e., X^2); Y is the outcome variable.
the path between the predictor and mediator (including the linear and quadratic term)
M ~ a*X + asq*X_SQ
the path between the mediator and outcome
Y ~ b * M
the indirect effect
Indirect effect := asq*b
I'm particularly unsure about the last line of codes. Can anyone please advise?