Closed JulianGaviriaL closed 2 years ago
Dear @JulianGaviriaL ,
in cSEM you cannot label your coefficients (a, b) as in lavaan. Moreover, if you want to specifiy transformations that are based on cSEM outputs such as total effects, you need to use the .user_funs argument. However, in your case, this is not necessary because all the relevant output is provided by the summarize function. Please respcify your model as follows: model <- '
Y ~ X
# mediator
M ~ X
Y ~ M
'
Be aware that cSEM cannot deal with observed variables in the strutcural model directly. They must be modeled as single indicator constructs, i.e., you need to specify a composite or reflective measurement model for X, M and Y. Consequently, the specified model will still produce an error.
Subsequently, you can estimate your model (given you have further specified X,Y and M): res <- csem(.data=myDATA,.model=model, .resample_method = "bootstrap", .R=1000)
Using the summarize function, you can get the desired output: summarize(res)
HTH
Best regards, Florian
Thank you very much Florian !
Dear @FloSchuberth
Given the model:
model <- "
# Composite variables
X <~ Brain_prev1 + Brain_prev2
M <~ behavior1 + behavior2
Y <~ Brain_curr1 + Brain_curr2
# direct effect
Y ~ X
# mediator
M ~ X
Y ~ M
"
res <- csem(.data=myDATA,.model=model, .resample_method = "bootstrap", .R=10000)
where:
a= M ~ X
b= Y ~ M
c'= Y ~ X
How can I compute c= c'+a*b? Namely, how can I obtain the estimate, Standard Error, T-stat, p-values and CI(95%) of the total effect?
P.D: the "Estimated total effects" section from summarize()
provides the info about the paths, but not the total effect. Conversely, "Estimated indirect effects" corresponds to the indirect effect [a x b (Nitzl, et al., 2016)].
Many thanks in advance.
Dear Julian,
so you see the total effect section. In this section, Y ~ X stands for the total effect, not the path coefficient/direct effect. It should be different from the path coefficient Y ~ X that you find in the top of the summarize output. Can you please confirm this.
Best regards, Florian
Dear @FloSchuberth
Thanks for your response. Extra bonus since it came in the weekend :-)
Two final comments before closing this issue:
You're right, the values of Y ~ X in both sections (i.e., "estimated path coefficients:" and "estimated total effects") are different.
I'm curious about the remaining values of the "estimated total effects" (i.e., "M ~ X" and "Y ~ M"): They do not change in relation to the "estimated path coefficients:". Also, what does total effects of "M ~ X" and "Y ~ M" mean?
Please find below my cSEM output of "estimated path coefficients:" and "estimated total effects" respectively.
Estimated path coefficients:
============================
CI_percentile
Path Estimate Std. error t-stat. p-value 95%
M ~ X -0.8261 0.0457 -18.0819 0.0000 [-0.9194;-0.7354 ]
Y ~ X 0.2034 0.2571 0.7912 0.4288 [-0.2888; 0.7551 ]
Y ~ M -0.6363 0.2552 -2.4932 0.0127 [-1.0669;-0.0450 ]
------------------------------------ Effects -----------------------------------
Estimated total effects:
========================
CI_percentile
Total effect Estimate Std. error t-stat. p-value 95%
M ~ X -0.8261 0.0457 -18.0819 0.0000 [-0.9194;-0.7354 ]
Y ~ X 0.7290 0.0904 8.0672 0.0000 [ 0.5241; 0.8757 ]
Y ~ M -0.6363 0.2552 -2.4932 0.0127 [-1.0669;-0.0450 ]
Best regards,
Hey Julian,
Indeed for these two the total and the direct effect (estimated path coefficient) are the same. The reason for that is that there is no indirect effect of the independent variable (X) on the dependent variable (M). The same is true for Y~M. In this case the total effect equals the direct effect.
Best regards, Florian
Von: JulianGaviriaL @.***> Gesendet: Sonntag, 25. Juli 2021 18:26:00 An: M-E-Rademaker/cSEM Cc: Schuberth, F. (ET); Mention Betreff: Re: [M-E-Rademaker/cSEM] Mediation analysis for Composite-Based Structural Equation Modeling in cSEM (#435)
Dear @FloSchuberthhttps://github.com/FloSchuberth
Thanks for your response. Extra bonus since it came in the weekend :-)
Two final comments before closing this issue:
You're right, the values of Y ~ X in both sections are different.
I'm curious about the remaining values of the "estimated total effects": They do not change in relation to the "estimated path coefficients:". What does it mean total effects of "M ~ X" and "Y ~ M"?
Please find below my cSEM output of "estimated path coefficients:" and "estimated total effects" respectively.
CI_percentile
Path Estimate Std. error t-stat. p-value 95% M ~ X -0.8261 0.0457 -18.0819 0.0000 [-0.9194;-0.7354 ] Y ~ X 0.2034 0.2571 0.7912 0.4288 [-0.2888; 0.7551 ] Y ~ M -0.6363 0.2552 -2.4932 0.0127 [-1.0669;-0.0450 ]
------------------------------------ Effects -----------------------------------
CI_percentile
Total effect Estimate Std. error t-stat. p-value 95% M ~ X -0.8261 0.0457 -18.0819 0.0000 [-0.9194;-0.7354 ] Y ~ X 0.7290 0.0904 8.0672 0.0000 [ 0.5241; 0.8757 ] Y ~ M -0.6363 0.2552 -2.4932 0.0127 [-1.0669;-0.0450 ]
Best regards,
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/M-E-Rademaker/cSEM/issues/435#issuecomment-886225675, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD5KRRCWL6FQNTHVC7DTM6LTZQ3JRANCNFSM47QKBG2A.
Thank you very much Florian, Best regards,
Dear cSEM experts,
I wonder how can I run my mediation analysis in cSEM (i.e., direct and indirect effects). I've read that the syntax is lavaan-based. That's why I tried the following:
myDATA<- read_excel("XXX/data.xlsx", sheet = "data")
Unfortunately I get following error message:
data.xlsx
My source for the medition syntax in lavann is: https://lavaan.ugent.be/tutorial/mediation.html
Many thanks in advance,
Julian