R - Multigroup CFA with lavaan Example

  Рет қаралды 12,148

Statistics of DOOM

Statistics of DOOM

Күн бұрын

Пікірлер: 61
@wac37
@wac37 5 жыл бұрын
Another superb lecture! Sums up 2 weeks of SEM class review. Brilliant!
@StatisticsofDOOM
@StatisticsofDOOM 5 жыл бұрын
Thank you!
@leguaani1234
@leguaani1234 3 жыл бұрын
This is great! Helped me so much with a project. Thank you very much for contributing.
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
Thanks for the kind words!
@michalkohut2787
@michalkohut2787 2 жыл бұрын
Thank you very much! The part with looping of partial invariance really helped as I'm using bifactor model with robust CFI and RMSEA, so the partialInvariance() is no use for me. Lovely lecture!
@StatisticsofDOOM
@StatisticsofDOOM 2 жыл бұрын
Glad to have helped!
@angelzamoramartinez9846
@angelzamoramartinez9846 2 жыл бұрын
Gracias, mega útil
@michaelmatta7069
@michaelmatta7069 4 жыл бұрын
That is a great video! Thanks so much for your contribution. Quick question about the possibility to use the eqMI.main function for more than two groups. I tried with three groups, but I got the following message: "Error in (function (...) : projection method only applies to two groups with this function." When I use only two, everything works fine. What would you recommend in this case? Should I run the same procedure for each pair (i.e., 1 vs 2, 2 vs 3, 1 vs 3)?
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
Hmm good question. I hadn't played with it for more than two groups obviously. That would be my recommendation, as that's what you would have to do anyway to figure out where the invariance is either way.
@alissawie4143
@alissawie4143 3 жыл бұрын
Thanks a lot for that great video! I was just wondering if you have any idea how to get the CFI calculated by the WLSMV estimation method in the last partial invariance part where you list the CFIs in a decreasing way? So I am stuck at the line: CFI_list [i]
@StatisticsofDOOM
@StatisticsofDOOM 2 жыл бұрын
Oh, I do not. I would recommend probably calculating it manually - the formula is in the notes for the lecture video (check out the fit indices video here statisticsofdoom.com/page/structural-equation-modeling/).
@timgehrmann7933
@timgehrmann7933 2 жыл бұрын
Thanks for the video! It saved my life (or at least thesis) so far... I wonder if you know of any way to persuade R into equivalence testing with robust chi square values after WLSMV estimation? Thank you in advance :)
@StatisticsofDOOM
@StatisticsofDOOM 2 жыл бұрын
... not sure honestly. I thought the X2 provided was always the robust one. Maybe check the lavaan help pages lavaan.ugent.be/
@jfc_mx4697
@jfc_mx4697 3 жыл бұрын
Hi Dr. Buchanan, I am wondering how I would go about controlling for variances of other variables before fitting the models. Do you have any recommendations? Furthermore, I am wondering how this invariance test can be conducted for second order factor structures. I have searched the web vigorously for information. I figured my best bet was to ask you. (:
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
You would need to custom program a model that includes the other variables but does not automatically test them. I would recommend checking out the guide on lavaan's website to determine how to write the model structure for only the specific paths you are interested in testing. The Beaujean and Brown books both cover higher order structure tests.
@annawhitehouse9762
@annawhitehouse9762 3 жыл бұрын
Hi Dr. Erin! Great video! I'm trying to follow along with some of my own data, but have not been successful in running the eqMI.main function. I get this error: Error in as.character.default(x) : no method for coercing this S4 class to a vector. I have tried changing my group variable to a factor with different levels, but the same error popped up. Do you have any suggestions?
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
Yes! I have a new video that I need to make visible that does not use this package because it seems to have a new error every week!
@annawhitehouse9762
@annawhitehouse9762 3 жыл бұрын
@@StatisticsofDOOM that’s great to hear! Thanks for your quick reply :)
@stanciuadrian9827
@stanciuadrian9827 3 жыл бұрын
So helpful! Thank you for this clear guide. Re 2021 status: Are the packages here in use still valid or any of them are or will be depracated soon?
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
I know people have had a lot of issues with equal test MI. It is still out there, but I know I get emails about it not working (unclear if it's user error or package issues). I just posted an update that shows you how to do MG totally in lavaan if you can't get this one to work. kzbin.info/www/bejne/d4i1iHZ9l7p4oLc
@zahid1609
@zahid1609 3 жыл бұрын
Thank you very much. This helped me a lot. You have explained the partial invariance of residuals. I am very new in learning R. Would you please share the syntax of partial invariance for metric and scaler ? or what change I should do in the syntax of partial invariance of residuals to get it for metric and scaler? I tried by using "=~" & "~1" but it returned constant values 😞
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
Check out the 2020 update for examples: statisticsofdoom.com/page/structural-equation-modeling/
@orlandosabogal6103
@orlandosabogal6103 4 жыл бұрын
Nice video! thank you very much. Can you paste here the link to te videos you mention at the beggining of the talk? (the links seems not to be working anymore)
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
I am working on the website now, been some issues with the provider. You can find the MGCFA videos here for now: kzbin.info/door/MdihazndR0f9XBoSXWqnYgsearch?view_as=subscriber&query=multigroup+cfa
@NormanMendoza0421
@NormanMendoza0421 3 жыл бұрын
Hi Dr. Erin! Thank you so much for this helpful lecture. If the model was invariant until scalar, what does this mean? I’m testing the MI of a scale for paper-and-pen method vs online.
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
That means it’s all the same up to the scalar step. So there’s probably a difference in the intercepts between the groups.
@medinachely
@medinachely 3 жыл бұрын
Can I follow this procedure for a SEM (structural model)?
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
Yep! Check out the full set of different options at: lavaan.ugent.be/tutorial/groups.html
@jykeem5454
@jykeem5454 3 жыл бұрын
Thanks for sharing brilliant lecture :) your lectures have been very helpful for starting my career as a scientist. Just have one question tho. I am trying to do invariance testing of hirarchical model. When i typed in eqmi.main code and a warning appeared that says “[.data.frame’(dotdotdot$data, , c(useVar, dotdotdot$group)) : undefined columns selected.” When i ran eqmi.main for overall factor (non-hierarchical) model, such warning did not appear. Data sets for each model are the same. Could you kindly explain why am i having this problem?
@StatisticsofDOOM
@StatisticsofDOOM 3 жыл бұрын
Literally don’t know what causes this error - you aren’t the first one to see it. I have some newer examples on the channel that show how to do the test manually so you don’t have to use this package.
@samanthadouglas2726
@samanthadouglas2726 4 жыл бұрын
Hi! Do you know how eqMI.main handles missing data? I can't seem to find documentation on it, and keep getting an error (Error in (function (..., lamb0 = NULL) : Check missing data in raw data or NAs in the sample covariances). When I add in the argument missing = TRUE it does not seem to work either. When I test the overall model with CFA I do not get this error.
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
I don't think it does - you have to have a model without missing data. I seem to remember this from testing it myself for a project, but the documentation should say. cran.r-project.org/web/packages/equaltestMI/equaltestMI.pdf
@vania7302
@vania7302 2 жыл бұрын
This was brilliant and so helpful to finally make a break testing for invariance in my CFA. Thank you so much! I do have a question as to whether the eqMI.main function can also be used to test for multigroup path analysis, and if the steps would be the same. I have tried dipping my toes but I keep getting an error that I have missing data (even though I already made sure to filter that).
@StatisticsofDOOM
@StatisticsofDOOM 2 жыл бұрын
I've had a lot of problems with that package and actually recommend just doing it manually now (I have updates to this video). And yes, you could do it with path analysis as well.
@vania7302
@vania7302 2 жыл бұрын
@@StatisticsofDOOMoh I'll definitely check the updated videos then! Thanks so much for pointing me to them!
@NormanMendoza0421
@NormanMendoza0421 4 жыл бұрын
Hi Dr. Erin, (this might be a naive question but) I want to ask what names should I include in the code below, to also include chi pvalue, and upper and lower limit of 90% CFI in the table? Thanks heaps! table_fit[1, ]
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
The p value is just "pvalue" (you can run fitmeasures(fit.MHQ) to see everything available). The only CI provided is RMSEA, so you'd have to calculate how to do the CI on CFI yourself. I actually haven't ever tried that, but this article may have some help: www.tandfonline.com/doi/abs/10.1080/10705511.2018.1562351?journalCode=hsem20
@shaman14302
@shaman14302 4 жыл бұрын
Hello Dr. Buchanan! when fitting the model for measurement invariance in lavaan, is it possible to correlate error terms on specific groups (e.g. Item1 ~~ Item2 on group 2 only, not the whole model)? Thank you!
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
Yes - I would tell you to check out the section on the lavaan page: lavaan.ugent.be/tutorial/groups.html that says fix the parameters in some groups but not all. You'd do something like Item1 ~~ c(0, NA)*Item2 so the first group is not estimated (it's zero), and the second group is estimated.
@shaman14302
@shaman14302 4 жыл бұрын
@@StatisticsofDOOM Thank you very much!!!
@yuliaegorova589
@yuliaegorova589 4 жыл бұрын
If i find that my model is nit invariant at scalar model stage, do I stop there ( do partial invar test) or I still need to continue to run strict (error invariance)?
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
I would use partial invariance to figure out which items were the non-invariant ones.
@chellymaes5657
@chellymaes5657 4 жыл бұрын
Thanks for the video! When running eqMI.main, I get the following error : Error in if (max(abs(dtheta)) > ep) break : missing value where TRUE/FALSE needed. I checked whether there were any missing values in my group variable but no missing values are found. Do you know what this error might mean?
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
You know, someone else asked this question, and I'm not sure we ever figured it out. What's the entire eq command you are trying?
@chellymaes5657
@chellymaes5657 4 жыл бұрын
@@StatisticsofDOOM I checked the data again and there appeared to be a missing value in one of my items of my subscale. So now everything is resolved but I'm having trouble with my partial invariance testing: I want to test partial invariance for my scalar invariance model, but if I run the code, the values in my CFI list are the same for every item: acc1 ~1 acc1 acc2 ~1 acc2 acc3 ~1 acc3 acc4 ~1 acc4 acc6 ~1 acc6 ..... until my 17th item. 0.9488962 0.9488962 0.9488962 0.9488962 0.9488962 I don't know if I did something wrong in my code? Or does this mean that partial invariance does not improve my model? Thank you for looking at my question!
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
@@chellymaes5657 That usually means that it doesn't improve the model by relaxing that constraint. Are the other values changing at all?
@chellymaes5657
@chellymaes5657 4 жыл бұрын
@@StatisticsofDOOM Yes they were, I found my items by which relaxing the constraint improved the model! Thank you for your fast response :) !
@TeckEnigm
@TeckEnigm 4 жыл бұрын
Thanks for the video! When running eqMI.main I get the following error that I can't solve, unfortunately: Error in `[.data.frame`(dotdotdot$data, , c(useVar, dotdotdot$group)) : undefined columns selected While when running eqMI.projection I get another error: Error in FUN(X[[i]], ...) : 'x' has to be numeric
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
Have you checked that the group variable is in the dataframe?
@TeckEnigm
@TeckEnigm 4 жыл бұрын
@@StatisticsofDOOM yes, it is in the data frame. I don't get the error when running cfa or sem
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
@@TeckEnigm Dug through the code, could be an error in a few place. Can you paste the entire eqMI command?
@BloopyBlobBob
@BloopyBlobBob 4 жыл бұрын
Hi, what does it mean when the unstandardised indicator intercept estimates are higher in one group for each item, but the standardised estimates vary? Items on a depression scale for instance, male vs. female samples.
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
Vary how? (like they are smaller instead of larger?)
@BloopyBlobBob
@BloopyBlobBob 4 жыл бұрын
Statistics of DOOM some are slightly smaller, some are slightly larger. But unstandardised are all larger in the male group, compared with the female group.
@BloopyBlobBob
@BloopyBlobBob 4 жыл бұрын
A follow up question, if i have this configural model > iq =~ i1 + i2 + i3, + i4 and then I add + i2 ~~ c(NA,0)*i4 to it, does this second line free up the constraints on the residual covariance between i2 and i4 in the male sample, and fixes it to 0 in the female sample (if group 1 = male, group 2 = female)? Is this considered partial invariance? And in plain terms, if doing this does not result in a significantly poorer fit, does it mean that items 2 and 4 are somehow correlated for men, but not women?
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
@@BloopyBlobBob I think that should be correct yes.
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
@@BloopyBlobBob Then I would interpret the pattern of the data that X is larger than Y, etc.
@jfc_mx4697
@jfc_mx4697 4 жыл бұрын
First and foremost, i am running version 3.6.3 of R, using R studio interface and using a Windows 10 operating system. When i run the code chunk for ## create a picture, i get the following error: "Error: package or namespace load failed for 'semPlot' in loadNamespace(i, c(lib.loc,libpath()), versionCheck =vI[[i]]:there is no package called igraph". I don't think the package igraph is available for the version of R i am using, 3.6.3. Is there a way i can fix this error and still use the semPlot package? if not, is there another package i can use to create a similar picture? if so, can you tell me which package? can you also provide the code for the picture? In any case, i love your youtube videos. They are very informative. :)
@StatisticsofDOOM
@StatisticsofDOOM 4 жыл бұрын
Thanks! Try installing the igraph package directly, install.packages("igraph")...I have 3.6.3, and it's available for me to download. That should solve your problem.
@jfc_mx4697
@jfc_mx4697 4 жыл бұрын
@@StatisticsofDOOM Thanks :) installing igraph directly solved it.
R - Multigroup CFA Class Assignment 2
46:37
Statistics of DOOM
Рет қаралды 711
R - Multigroup CFA Lecture
1:24:10
Statistics of DOOM
Рет қаралды 2,5 М.
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 6 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
Двое играют | Наташа и Вова
Рет қаралды 2,2 МЛН
ЭТО НАСТОЯЩАЯ МАГИЯ😬😬😬
00:19
Chapitosiki
Рет қаралды 3,5 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 118 МЛН
Interpreting CFA Output
30:29
Deeply Trivial
Рет қаралды 16 М.
CFA lavaan: Bifactor Analysis in R
11:16
Regorz Statistik
Рет қаралды 3,6 М.
Multigroup CFA: Measurement Invariance Explained
16:22
QuantFish
Рет қаралды 2,9 М.
Path analysis in R using Lavaan (video 1; Sept, 2019)
26:09
Mike Crowson
Рет қаралды 43 М.
Why Use CFA & SEM for Longitudinal Data?
13:18
QuantFish
Рет қаралды 395
R - Item Response Theory Example
36:01
Statistics of DOOM
Рет қаралды 36 М.
Confirmatory Factor Analysis in Lavaan (2019)
12:54
Sacha Epskamp
Рет қаралды 4,5 М.
Evaluating Measurement Invariance in Structural Equation Models
1:00:29
American Psychological Association
Рет қаралды 1,2 М.
Multi-Group CFA: Measurement Invariance
14:23
benR
Рет қаралды 3 М.
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 6 МЛН