## You are here

The OpenMx website will be down for maintenance from 9 AM EDT on Tuesday, September 17th, and is expected to return by the end of the day on Wednesday, September 18th. During this period, the backend will be updated and the website will get a refreshed look.

# Using "mxAlgebras" to compare indirect effects

3 posts / 0 new
Offline
Joined: 10/19/2023 - 08:19
Using "mxAlgebras" to compare indirect effects

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

Offline
Joined: 10/08/2009 - 22:37
Dear Jennis,

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

Offline
Joined: 03/01/2013 - 11:03
mxCI on mxAlgebra

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!