Hi,
I would like to perform a mediation analysis by defining the indirect effects with mx.algebras in the wls() funktion.
I tried mx.algebras= list( ind=mxAlgebra(b410*b14, name="ind"))), where b410 and b14 refer to the paths in the A matrix. However, I get the following error in the analysis:
Error in running the mxModel:
Error in wls(Cov = R, asyCov = acov, n = n, Smatrix = S, Amatrix = A, :
object 'out' not found
In addition: Warning message:
In runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
SLSQP: Failed due to singular matrix E or C in LSQ subproblem or rank-deficient equality constraint subproblem or positive directional derivative in line search
What I am doing wrong?
Looking forward to your help. Thanks!
Hi, Johannes.
Could you please include the data and R code so that we can replicate the error?
Mike
Thanks, I atteched the R file.
Johannes
Hi, Johannes.
I have identified two issues: (1) the variances of the independent variables are not fixed at 1; and (2) some of the independent variables are not correlated.
Based on your A matrix, I have modified the S matrix. Attached are the results. Hope it helps.
Mike
Hi Mike,
Thank you very much! That helps a lot!
Johannes
I just saw that you specified in the S matrix ".3cor106" and ".3cor116" twice. Was that intendet?
When I change it to ".3cor106" and ".3cor107" and ".3cor116" and ".3cor11t" I have a model with df = 0. Then I cannot check my model fit right? Therefore, I would leave some correlations out that also make not really sense from a theoretical perspective?
Oh, yes. It was a mistake. They should be different. The model becomes saturated. Residuals are usually uncorrelated. You may consider this model.
Ok thanks. So how would you suggest to specify the model? Without correlated residuals?
Thanks for your help.
The models should be specified based on your theories (hypotheses). If your theories hypothesize that all the association among the dependent variables can be explained by the independent variables, the residuals should be uncorrelated; otherwise, they can be correlated.
Mike