Mediation analysis

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
Hi, Johannes.
Could you please include the data and R code so that we can replicate the error?
Mike
Log in or register to post comments
In reply to Hi, Johannes. Could you by Mike Cheung
Thanks, I atteched the R
Thanks, I atteched the R file.
Johannes
Log in or register to post comments
In reply to Thanks, I atteched the R by jode
Hi, Johannes. I have
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
Log in or register to post comments
In reply to Hi, Johannes. I have by Mike Cheung
Hi Mike, Thank you very much!
Hi Mike,
Thank you very much! That helps a lot!
Johannes
Log in or register to post comments
In reply to Hi Mike, Thank you very much! by jode
I just saw that you specified
I just saw that you specified in the S matrix ".3*cor106" and ".3*cor116" twice. Was that intendet?
When I change it to ".3*cor106" and ".3*cor107" and ".3*cor116" and ".3*cor11t" 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?
Log in or register to post comments
In reply to I just saw that you specified by jode
Oh, yes. It was a mistake.
Oh, yes. It was a mistake. They should be different. The model becomes saturated. Residuals are usually uncorrelated. You may consider this model.
Log in or register to post comments
In reply to Oh, yes. It was a mistake. by Mike Cheung
Ok thanks. So how would you
Ok thanks. So how would you suggest to specify the model? Without correlated residuals?
Thanks for your help.
Log in or register to post comments
In reply to Ok thanks. So how would you by jode
The models should be
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
Log in or register to post comments