Hi Mike, Thank you for this extremely useful tutorial! I'm just wondering with model 1-1-1, could you explain whether we should interpret level 1 or level 2 regression coefficients? If my interest is in level 1 variables but I want to control for the effect of clusters, do I just focus on the output for level 1? Any help would be much appreciated. Thank you!
Thanks for making this video! Just curious, at 18:07, why that variance is defined and only at the second level? teamidentification~~teamidentification
Hi Mike, thanks for sharing! May I know if it is possible to have parallel mediations in the multi-level analysis? such as I have a level 1 mediator and a level 2 mediator at the same time?
Dear Mike, can I request you to kindly make a video performing multi-level CFA. I don't think that multi-level CFA can be performed with 'R' using the method adopted to perform simple CFA.
Dear @@mikecrowson2462, I will request to consider if you can reprioritize the "to-do list" to accommodate this application soon:-) In fact, I am working on a multi-level data and this video can be really helpful in expediting my analysis and early submission. Meanwhile, I can also understand your problems because this requires a lot of search and study. Anyhow, thanks for all the great work you are doing to help us, and please keep it up.
Thanks for this video! I’m also attempting to run a multi-level CFA, though I’m running into convergence issues with my model. Both my level 1 and 2 models are specified as the same, and the one level model converges without issue. However, when I add the second model (2 level) it no longer converges. Any tips for troubleshooting convergence issues?
Hi Mike, I wonder if we should mean group center the mediator and outcome in this case? I had the impression to model the variance of variables truly at level 1, we need to groupmean center them.
Hi there, I have updated the links. However, I have two new videos on multilevel mediation with RStudio that I've just recorded: ua-cam.com/video/jaZtRgBJ_Tk/v-deo.html ua-cam.com/video/mayQ79h_Dt8/v-deo.html Additionally, I have examples of R code for three different types of models (2 of which go with the videos) at these locations: mikesquanthub.blogspot.com/2024/04/multilevel-path-analysis-in-lavaan.html mikesquanthub.blogspot.com/2024/04/multilevel-path-model-using-lavaan.html mikesquanthub.blogspot.com/2024/04/multilevel-path-anaylysis-in-lavaan.html
@@mikecrowson2462 Thanks so much! I'm wondering if a 2-1-1 Model is even appropriate for our data as we don't have clusters, though model does seem similar to the video above where we're trying to test a categorical variable (treatment condition) on whether one metacognition mediates depression. Maybe Hayes' PROCESS macro is more appropriate?
Thank you for this! I do have a question. I know that using this method to conduct a multilevel mediation is not possible when using a categorical predictor. However, I am wondering if this has been updated or if there is a work around that you know that allows the use of a categorical predictor (e.g., group membership). Thanks!
Thank you for this video! I just did this analysis but got this error "Warning message:In lav_object_summary(object = object, header = header, fit.measures = fit.measures, : lavaan WARNING: fit measures not available if model did not converge". Could you please shed a light on why I got this and what I can do about it?
Hi Mike, Your work is amazing. I always come to your channel to resolve my analysis related issues. I have a question. Can we use lavaan for multilevel mediation if the DV is at level 2 while IVs and Mediators (serial and parallel) are measured at level 1?
Hi Sadaf, thank you for your question. I'll be honest. I'm really only familiar with models where the mediation goes from higher level units to lower level outcomes or mediation within level. It sounds like you are asking about meditation from lower level units to higher level. If something like that exists for Lavaan, I haven't heard of it. Cheers!
In the article you provided, they also tested bootstrap. Can we also have bootstrap results in multilevel SEM? If yes, could you explain how to test it?
Dear Mike, Thank you for this video. It helped me a lot! I have a question: How can I deal with latent exposure-variable with predictors at different leves? I really appreciate any suggestions!
Hi, I'm very new at statistical analysis, so I have a probably pretty basic question. Is Multilevel analysis a complex form of OLS (as Hierarchical Linear Modeling), or is it a different thing from OLS (as I vaguely know that SEM is)?
Hi! Thanks for visiting! This video was mainly about being able to run the analysis using lavaan syntax - and I was trying to keep this from being overly long. I'll probably work up other demonstrations involving more explicit interpretation in other videos in the future. Best wishes!
Dear Mike, this has been super helpful. However, when I tried this on my dataset, I got the error saying 'Error in lavParseModelString(model) : lavaan ERROR: syntax contains block identifier “level2” with missing number/label. The correct syntax is: "LHS: RHS", where LHS is a block identifier (eg group or level), and RHS is the group/level/block number or label.' Do you have any idea what that might be about?
Thank you Mike for this amazing video! Do you know whether we can use this to examine multiple mediators and their indirect effects for mutilevel models ?
Hi Fangjing, You should be able to examine multiple mediators and indirect effects in these models in multilevel models following the general logic laid out in this presentation. However, I haven't worked out the strategy for accomplishing those types of analyses yet. However, I will put it on my 'to-do' list for sometime in the future. Thanks for visiting!
Thanks for this video -- it's very helpful. I'm curious about why you use R/Lavaan rather than Stata/gsem. Any thoughts on which program does multilevel mediation modeling better? (I mostly program in Stata, but can use R when necessary)
Hi Leanne, thank you for visiting, and for your questions. To tell the truth, I put this video together as a general demo for folks who use R/lavaan. So the short answer to your question is, "It was on my mental to-do list". At some point I'll probably work something up for Stata (although I'll try to move it forward on my list ;) I haven't really spent time unpacking which program might be 'better' though. I would assume, however, they would give similar results - assuming the same model specifications. Thanks again for your questions. Best wishes!
could I use this 2-1-1 model into the longitudinal dataset: one patient visit doctor for multiple time and we measure the treatment, disease score and pain level. So we want to understand whether the disease score improvment by the treatment through the improvment of pain?
if my dataset has 406 employees at level 1 nested within 6 organizations BUT all the rest of the fields are level 1 , do i still need to do multi level analysis? Do i do a 1-1-1? This is survey data on likert scale with 35% missing data :-( ....not my project , i am helping a friend with her Phd
Hi Marvin, it's really difficult to understand multilevel SEM without having some background in basic multilevel modeling concepts. You have to think of the data as forming a hierarchy, where level 1 variables are measured at the 'individual level' (in this case) and the level 2 variables are measured at the 'team level' (in this case). I would recommend spending some time learning some of the basics of hierarchical linear modeling before broaching this topic, because it's a different animal from standard single-level approaches. I do have a number of videos on hlm (aka multilevel modeling) that might be useful as an introduction. Below are links to 4 videos. The first two rely on SPSS and the latter 2 involve using the lme program in R. I hope this helps! ua-cam.com/video/RU1ps6jaheI/v-deo.html ua-cam.com/video/x5Z5KYODwNk/v-deo.html ua-cam.com/video/LzAwEKrn2Mc/v-deo.html ua-cam.com/video/8r9bUKUVecc/v-deo.html
Hello Mike, I am so glad I found your video! I am doing an MSEM with lavaan for my Master thesis and there is nearly no guidance online whatsoever. May I ask two questions regarding your 2-1-1 Model A?: 1.) Control Variables - I would like to add gender and age since I suppose they may be correlated with my x and y variables. Where do they come in? - only at level 1 since they belong to the individual? On the lavaan webpage (lavaan.ugent.be/tutorial/multilevel.html) it is said that only continuous variables can be included, this would obviously rule out gender, is that correct? 2.) Interpretation - thanks to your guidance I put my 2-1-1 model together. At level 1, the summary shows a significant relationship between my mediator and the outcome. However, at level 2 this relationship is not significant any longer, by far. Same for the relationship between my independent group variable and the outcome. Yet, the relationship between the group variable and the mediator is significant. Can I therefore accept my mediation hypothesis based on the significant relationship between mediator and outcome at level 1 and between group variable and mediator at level 2? (Of "defined parameters" only total is significant at 0.049) Thank you so much for this video and for you help!
Hi Andreas, thank your for visiting and for your questions. Regarding #1, if I'm not mistaken you should be able to simply add in the measured variables (gender and age) to the equations at Level 1 to control for them. Also, although it says that only continuous variables can be included, I believe they are meaning that your variables are not being treated as factor variables (either in the model using the factor function, or within your data frame - saved as a factor variable). You should be able to include a binary predictor (such as gender) in the model as a predictor. By extension, you could also include categorical variables as predictors, so long as they are properly recoded (e.g., dummy coded) into binary variables. Now, your endogenous variables within the model should all be treated as continuous, and the assumption is that they are multivariate normally distributed (see e.g., Kline, 2015). Regarding #2, the test of mediation at different levels are essentially tests of indirect effects within groups and between groups. Keep in mind that the relationships within groups can be different from those at the group level. And this is one of the reasons (though not the only reason) why multilevel analysis might be chosen - i.e., to account for possible differential relationships that may occur at different levels of the data hierachy. Just like relationships between two variables may be different across levels within the data hierarchy, so too can mediated/indirect effects. You might check out this video (I was using an SPSS macro) where I articulate this point: ua-cam.com/video/bAzOekt39fQ/v-deo.html .Hope this helps!
Hi Mike,
Thank you for this extremely useful tutorial! I'm just wondering with model 1-1-1, could you explain whether we should interpret level 1 or level 2 regression coefficients? If my interest is in level 1 variables but I want to control for the effect of clusters, do I just focus on the output for level 1? Any help would be much appreciated. Thank you!
Hi Maitan! I have the same exact question. did you by any chance figure this out? Could you let me know! Thanks
Thanks for making this video! Just curious, at 18:07, why that variance is defined and only at the second level? teamidentification~~teamidentification
same question on my mind.
Thank you Mike! That's very helpful!
This is amazing. Thank you so much :)
You're very welcome! Thanks for visiting!
Hi Mike, thanks for sharing! May I know if it is possible to have parallel mediations in the multi-level analysis? such as I have a level 1 mediator and a level 2 mediator at the same time?
Hi, this es great. Thank you. Do you know if this analysis incorporate random slope or just random intercept?
Dear Mike, can I request you to kindly make a video performing multi-level CFA. I don't think that multi-level CFA can be performed with 'R' using the method adopted to perform simple CFA.
Hi Qaiser, I will see what I can do. This is certainly on my "to-do" list :) Best wishes!
Dear @@mikecrowson2462, I will request to consider if you can reprioritize the "to-do list" to accommodate this application soon:-) In fact, I am working on a multi-level data and this video can be really helpful in expediting my analysis and early submission. Meanwhile, I can also understand your problems because this requires a lot of search and study. Anyhow, thanks for all the great work you are doing to help us, and please keep it up.
Thanks for this video! I’m also attempting to run a multi-level CFA, though I’m running into convergence issues with my model. Both my level 1 and 2 models are specified as the same, and the one level model converges without issue. However, when I add the second model (2 level) it no longer converges. Any tips for troubleshooting convergence issues?
Hi Mike, I wonder if we should mean group center the mediator and outcome in this case? I had the impression to model the variance of variables truly at level 1, we need to groupmean center them.
Did you ever hear back about your question? I have the same :)
Can we run moderated mediation? For example, my moderator(between IV andand mediator) is at Level 2, while IV, mediator, and DV are all level 1.
HI Mike, can I ask whether this can be done with a three way interaction as an IV?
Thank you so much for this video!
Hey, do you have an updated R code? It looks like the google doc is down!
Hi there, I have updated the links. However, I have two new videos on multilevel mediation with RStudio that I've just recorded:
ua-cam.com/video/jaZtRgBJ_Tk/v-deo.html
ua-cam.com/video/mayQ79h_Dt8/v-deo.html
Additionally, I have examples of R code for three different types of models (2 of which go with the videos) at these locations:
mikesquanthub.blogspot.com/2024/04/multilevel-path-analysis-in-lavaan.html
mikesquanthub.blogspot.com/2024/04/multilevel-path-model-using-lavaan.html
mikesquanthub.blogspot.com/2024/04/multilevel-path-anaylysis-in-lavaan.html
@@mikecrowson2462 Thanks so much!
I'm wondering if a 2-1-1 Model is even appropriate for our data as we don't have clusters, though model does seem similar to the video above where we're trying to test a categorical variable (treatment condition) on whether one metacognition mediates depression. Maybe Hayes' PROCESS macro is more appropriate?
Very good!
Thank you for this! I do have a question. I know that using this method to conduct a multilevel mediation is not possible when using a categorical predictor. However, I am wondering if this has been updated or if there is a work around that you know that allows the use of a categorical predictor (e.g., group membership). Thanks!
Thank you for this video! I just did this analysis but got this error "Warning message:In lav_object_summary(object = object, header = header, fit.measures = fit.measures, : lavaan WARNING: fit measures not available if model did not converge". Could you please shed a light on why I got this and what I can do about it?
Hi Mike,
Your work is amazing. I always come to your channel to resolve my analysis related issues. I have a question. Can we use lavaan for multilevel mediation if the DV is at level 2 while IVs and Mediators (serial and parallel) are measured at level 1?
Hi Sadaf, thank you for your question. I'll be honest. I'm really only familiar with models where the mediation goes from higher level units to lower level outcomes or mediation within level. It sounds like you are asking about meditation from lower level units to higher level. If something like that exists for Lavaan, I haven't heard of it. Cheers!
Thank you so much for your response
In the article you provided, they also tested bootstrap. Can we also have bootstrap results in multilevel SEM? If yes, could you explain how to test it?
Hi Mike how can you make use of sempaths with multilevel mediation. ?
Dear Mike, Thank you for this video. It helped me a lot! I have a question: How can I deal with latent exposure-variable with predictors at different leves? I really appreciate any suggestions!
Hi, I'm very new at statistical analysis, so I have a probably pretty basic question. Is Multilevel analysis a complex form of OLS (as Hierarchical Linear Modeling), or is it a different thing from OLS (as I vaguely know that SEM is)?
great work and a little bir more detail about how to report would be nice... thank you..
Hi! Thanks for visiting! This video was mainly about being able to run the analysis using lavaan syntax - and I was trying to keep this from being overly long. I'll probably work up other demonstrations involving more explicit interpretation in other videos in the future. Best wishes!
Dear Mike, this has been super helpful. However, when I tried this on my dataset, I got the error saying 'Error in lavParseModelString(model) : lavaan ERROR:
syntax contains block identifier “level2” with missing
number/label. The correct syntax is: "LHS: RHS", where LHS is a
block identifier (eg group or level), and RHS is the
group/level/block number or label.'
Do you have any idea what that might be about?
Thank you Mike, this video basically saved my dissertation and my pale little ass!! Amazing work!
Thank you Mike for this amazing video! Do you know whether we can use this to examine multiple mediators and their indirect effects for mutilevel models ?
Hi Fangjing, You should be able to examine multiple mediators and indirect effects in these models in multilevel models following the general logic laid out in this presentation. However, I haven't worked out the strategy for accomplishing those types of analyses yet. However, I will put it on my 'to-do' list for sometime in the future. Thanks for visiting!
Great
Thanks for this video -- it's very helpful. I'm curious about why you use R/Lavaan rather than Stata/gsem. Any thoughts on which program does multilevel mediation modeling better? (I mostly program in Stata, but can use R when necessary)
Hi Leanne, thank you for visiting, and for your questions. To tell the truth, I put this video together as a general demo for folks who use R/lavaan. So the short answer to your question is, "It was on my mental to-do list". At some point I'll probably work something up for Stata (although I'll try to move it forward on my list ;) I haven't really spent time unpacking which program might be 'better' though. I would assume, however, they would give similar results - assuming the same model specifications. Thanks again for your questions. Best wishes!
could I use this 2-1-1 model into the longitudinal dataset: one patient visit doctor for multiple time and we measure the treatment, disease score and pain level. So we want to understand whether the disease score improvment by the treatment through the improvment of pain?
My question with that idea is how to control for temporal effects.
Your code returns the following when I try "Error: unexpected string constant in: "ab:=a*b total:ab+c'" Any ideas what I'm doing wrong here?
try the following on separate lines
ab:=a*b
total:=ab+c
cheers!
if my dataset has 406 employees at level 1 nested within 6 organizations BUT all the rest of the fields are level 1 , do i still need to do multi level analysis? Do i do a 1-1-1? This is survey data on likert scale with 35% missing data :-( ....not my project , i am helping a friend with her Phd
Hi Marvin, it's really difficult to understand multilevel SEM without having some background in basic multilevel modeling concepts. You have to think of the data as forming a hierarchy, where level 1 variables are measured at the 'individual level' (in this case) and the level 2 variables are measured at the 'team level' (in this case). I would recommend spending some time learning some of the basics of hierarchical linear modeling before broaching this topic, because it's a different animal from standard single-level approaches. I do have a number of videos on hlm (aka multilevel modeling) that might be useful as an introduction. Below are links to 4 videos. The first two rely on SPSS and the latter 2 involve using the lme program in R. I hope this helps!
ua-cam.com/video/RU1ps6jaheI/v-deo.html
ua-cam.com/video/x5Z5KYODwNk/v-deo.html
ua-cam.com/video/LzAwEKrn2Mc/v-deo.html
ua-cam.com/video/8r9bUKUVecc/v-deo.html
Hello Mike,
I am so glad I found your video! I am doing an MSEM with lavaan for my Master thesis and there is nearly no guidance online whatsoever.
May I ask two questions regarding your 2-1-1 Model A?:
1.) Control Variables - I would like to add gender and age since I suppose they may be correlated with my x and y variables. Where do they come in? - only at level 1 since they belong to the individual? On the lavaan webpage (lavaan.ugent.be/tutorial/multilevel.html) it is said that only continuous variables can be included, this would obviously rule out gender, is that correct?
2.) Interpretation - thanks to your guidance I put my 2-1-1 model together. At level 1, the summary shows a significant relationship between my mediator and the outcome. However, at level 2 this relationship is not significant any longer, by far. Same for the relationship between my independent group variable and the outcome. Yet, the relationship between the group variable and the mediator is significant. Can I therefore accept my mediation hypothesis based on the significant relationship between mediator and outcome at level 1 and between group variable and mediator at level 2? (Of "defined parameters" only total is significant at 0.049)
Thank you so much for this video and for you help!
Hi Andreas, thank your for visiting and for your questions. Regarding #1, if I'm not mistaken you should be able to simply add in the measured variables (gender and age) to the equations at Level 1 to control for them. Also, although it says that only continuous variables can be included, I believe they are meaning that your variables are not being treated as factor variables (either in the model using the factor function, or within your data frame - saved as a factor variable). You should be able to include a binary predictor (such as gender) in the model as a predictor. By extension, you could also include categorical variables as predictors, so long as they are properly recoded (e.g., dummy coded) into binary variables. Now, your endogenous variables within the model should all be treated as continuous, and the assumption is that they are multivariate normally distributed (see e.g., Kline, 2015). Regarding #2, the test of mediation at different levels are essentially tests of indirect effects within groups and between groups. Keep in mind that the relationships within groups can be different from those at the group level. And this is one of the reasons (though not the only reason) why multilevel analysis might be chosen - i.e., to account for possible differential relationships that may occur at different levels of the data hierachy. Just like relationships between two variables may be different across levels within the data hierarchy, so too can mediated/indirect effects. You might check out this video (I was using an SPSS macro) where I articulate this point: ua-cam.com/video/bAzOekt39fQ/v-deo.html .Hope this helps!
@@mikecrowson2462 Thank you so much for your help and I will check out the other video