Using "mxAlgebras" to compare indirect effects

Posted on
No user picture. jennies001 Joined: 10/19/2023
Forums
Hi community,

I am currently using the wls() function from the MetaSEM package to conduct mediation analysis with two parallel mediators. My code successfully estimates the indirect effects and their significance using likelihood-based confidence intervals. However, I am curious about estimating the difference between these indirect effects (e.g., between the two indirect effects).

I attempted to write a function such as a1b1 - a2b2, and it produced results. Now, I am wondering how reliable this practice is, as I have found little mention of it in Mike’s book and seminars.

Here is my code for reference:


MASEM_df2_Total_Effect <- wls(
Cov = corr_df,
aCov = acov_df,
n = sample_size,
diag.constraints = TRUE,
RAM = RAM,
cor.analysis = TRUE,
intervals.type = "LB",
mx.algebras = list(
Total = mxAlgebra(b12 * b24 + b13 * b34 + b14, name = "Total"),
Indirect_total = mxAlgebra(b12 * b24 + b13 * b34, name = "Indirect_total"),
Indirect_1 = mxAlgebra(b12 * b24, name = "Indirect_1"),
Indirect_2 = mxAlgebra(b13 * b34, name = "Indirect_2"),
Indirect_diff = mxAlgebra(b12 * b24 - b13 * b34, name = "Indirect_diff")
)
)

Best regards,
Jennis

Replied on Fri, 07/26/2024 - 10:29
Picture of user. Mike Cheung Joined: 10/08/2009

Dear Jennis,

I am unaware of any meta-analysis studies, but there is one on the primary studies. It works reasonably well.

Cheung, M. W.-L. (2007). Comparison of approaches to constructing confidence intervals for mediating effects using structural equation models. Structural Equation Modeling: A Multidisciplinary Journal, 14(2), 227–246. https://doi.org/10.1080/10705510709336745

Best,
Mike

Replied on Fri, 07/26/2024 - 15:11
Picture of user. AdminHunter Joined: 03/01/2013

If the wls() function returns an MxModel object class, then you can add profile likelihood confidence intervals directly on the mxAlgebra's. You can then run them with omxRunCI().

I'm happy to elaborate if needed!

Replied on Thu, 03/20/2025 - 12:05
No user picture. jennies001 Joined: 10/19/2023

Dear Mike and Hunter,

Thank you so much for your responses! (Also, sorry for the late reply—it took me some time to return to this project.) I have gone through the information you shared, and I feel these codes are on track now.

I have one more related question. When comparing path coefficients and indirect effects calculated based on them, is it generally preferable to use standardized coefficients? I use correlation as the input for meta-analysis, and I think it can be considered a standardized coefficient unless I am overlooking something important. Does that sound correct?

I also tried the univariate approach by putting the correlation matrix and harmonic mean into AMOS or the R sem() function, and I found that the standardized estimates were the same as the unstandardized ones (there is no latent variable in the model). I did not find an explicit argument in TSSEM or WLS() to select standardized estimation, but I guess the results would not differ between standardized and unstandardized versions (like other SEM programs). Is that correct?

Thanks again for your help.

Best,
Jennis