Using lme4 in R for Mixed Models
Vložit
- čas přidán 10. 09. 2024
- Do you want more structured and personalized information? Come take a class with me! Visit simplistics.net and sign up for self-guided or live classes.
You can find this same dataset here: quantpsych.net...
Here's how to identify whether an effect is fixed or random:
• How to decide whether ...
To learn how to go from wide to long format, see these videos:
• Going from wide to lon...
• Wide to long format pa...
Thanks for these videos. I just finished my master's thesis, and I'm working on transforming it into a publishable paper. I'm working with MLM and lme4 as well. You can't imagine how helpful your channel has been!
Dude, your videos are often far more helpful (and entertaining) than any textbook. Keep going!
Keep videos coming. There are awesome
Thanks a lot, it was very clear as usual.
I do have a small question about the Time variable. If we don't include the time in the model, do we really account for the repeated measures, event thous we had the ID as a cluster variable.
Maybe my question is naif, but the "TIME" variable still confuising for me when build models.
Thank you again (:
Yes and no. You are accounting for the dependencies with the cluster variable. But, if you're missing an important variable (time) then your model will be biased, just as a regular regression model would be biased if it was missing an important explanatory variable.
Hey! Thank you for your videos, it's helped me a lot to understand basic multilevel modelling (need it for my masters thesis)! I was wondering where to find the flexplot-package, though? I tried to install it in RStudio but it doesn't show up.
You have to install through github: devtools::install_github("dustinfife/flexplot")
Hi , I like your videos, I'm doing some analysis for my master studies, can you help me or give me some advice how to model my data? I'm suffering a bit
This was incredibly helpful, thank you! It would be interesting to understand why one might also include the grouping variable as a fixed effect. I've seen such models, but the only explanation I got was: "If you don't include it as a fixed effect, then you will be assuming that the differences between levels are exactly zero on average, across all levels." If you have time, could you expand upon this sometime, please?
That's close, but not quite. If you fix the grouping variable, you assume the difference between the two groups is the same across clusters. So, maybe your grouping variable is gender (male/female) and your outcome is math achievement. A fixed effect model assumes that difference between boys/girls is the same across all schools. Maybe that's a reasonable assumption. But maybe there's some schools that have, for example, male tutoring programs. You might in that case see a much smaller difference between males and females.
@@QuantPsych Sorry, I got lost in the terminology. I should have said "what if the cluster variable (I called it the group variable), like "person_id" in this video, was also a fixed effect?" Sticking with your example, if instead of "person_id", we had "student" nested in school as cluster variables, why might we want to make student a fixed effect as well? For the same reason (male tutoring programs)? EDIT: After a bit more searching online, it seems we wouldn't include the cluster variable (person_id) as a fixed effect as well. It's one or the other, not both.
Thank you for your videos, it always helps me get a grasp of concepts before I read textbooks. Btw, I have successfully installed flexplot from github but I ran into a problem while using visualize function. It gives
Error in x[["stat"]] : this S4 class is not subsettable
I tried to figure it out on my own but still left unable to fix the error. Everything else seems to work fine though. Any help would be greatly appreciated!!
Start with a fresh environment and only load flexplot and lmer4. If that works, there may be a conflict with another package your trying to load. I seem to remember there's a package like lmerEffects or something that messes with flexplot.
Thanks for the video, I think it is very good. My problem with using R, you can't model with multiple plausible values as in the PISA dataset. But my biggest problem with that, there is no option for centering around mean, grand mean or z-scores. Could you help me with that, do I know wrong? So, I am gonna do my master thesis with gamlj3 module in jamovi.
You'll probably have to go to the data tab to do it. Or you can center in excel and reimport into jamovi.
@QuantPsych Thanks for the response. I can't use the excel because the data is PISA's and only .sav or SAS format available. But I wonder how we could this both with data tab in RStudio and R library that has functions to do it. Could you do a video about it, so that I may use R instead of GUI apps in further researchs?
Sent me for a loop on this one and had me rethinking my whole data :(