Building and Comparing Mixed Models in R: ICC, Bayes Factor, and Variance Explained
The process of comparing mixed models is actually simple!
Learning Objectives:
* What is the ICC and what does it tell us
* What is the general strategy for doing mixed models?
* Know the estimates of interest
This video is part of my multivariate playlist: This is part of a playlist on multivariate statistics: kzread.info?list...
Here are other videos about mixed models:
• Mixed Models, Hierarch...
• Mixed Model Notation -...
• Explaining Variance Ex...
For more information on using Flexplot, see this link: psyarxiv.com/kh9c3/
Пікірлер: 38
Thanks very much, your illustrations are very clear.
You make these things cool! Thanks! I am subscribing!
And also,you are sharing music theme with It's allways sunny in Philadelphia - Also brings a smile..
Hi Dustin. Thanks for your videos, they greatly develop the intuition behind Mixed Models and you also make me laugh sometimes :) . I am using flexplot 0.13.3 Even though I execute exactly the same lines of code as you in the video: baseline
Thanks!
Hey Dustin, I've been trying to plot the baseline model using flexplot::visualize and keep getting this error: Error in if (preds[i] != term.re) { : argument is of length zero The model and ICC run fine, I just cant get visualize to work. Dustin or anyone who knows what to do, your help would be appreciated.
Dear professor, can I ask how to show p value for the beta coefficient in summary functions??? Thanks !!!
Hi. I have clusters built yearly for twenty years. I want do get measures of variabulity ínter cluster and intra cluster but I dont know how to theoretically document my procedure. How can I?
Hmm I'm running this on my personal data, but when I visualize my baseline model (lmer(responsevariable~1+(1|cluster), data= my data), my red line is labeled "object (lmerMod)" instead of fixed effect and the random effects line is missing. Any idea what's causing this? My data set is much smaller than this example set. Could that be it?
Hey, Thanks very much for the great explanation. Unfortunately, visualize argument does not work, I followed and used the same code you explained, but the argument shows this error "Error in match.arg(plot, c("all", "residuals", "model")) : 'arg' should be one of “all”, “residuals”, “model”". Any solution?
What does an $icc output of "[1] 1, $design.effect [1] 13.42553" mean?
what would a random effect of the variable minority mean? and why wasn't it tested?
Thanks for this superb video! I'm using the same data from the flexplot package and running the same code of the video, but unfortunately the visualize function returns for any model (that I copied based on your script): Error in if (preds[i] != term.re) { : argument is of length zero Why could that be? Thanks!
@teslanova
Жыл бұрын
I had the same problem - turns out its if you've already loaded lmerTest into your library before you run the lmer function to build the models with lme4, it'll return this error. I fixed by just either 1. detaching the lmerTest package until later in the script when its needed or 2. telling r that you want to use the lmer function from lme4 specifically, lme4::lmer(...). From what I can gather the lmerTest overlays the {lme4} lmer function which causes that specific error. Hope that helps.
Hi there, thanks for the great videos, they are super helpful! I am currently trying to interpret model fits of fixed and random slopes models and am a bit confused regarding R-squared-change: > model.comparison(intensity_model_predicted, intensity_model_predicted_RS) refitting model(s) with ML (instead of REML) $statistics aic; bic; bayes.factor; p intensity_model_predicted 1146.993; 1161.407; 1851.166; 0.097 intensity_model_predicted_RS 1147.626; 1176.454; 0.001 $predicted_differences 0% 25% 50% 75% 100% 0.012 0.898 2.407 4.703 25.677 $r_squared_change (Intercept) Residual -0.3032796 -0.6475945 From the $statistics output, I'd conclude that the model in the upper row (fixed effects model) probably explains the data much more accurately than the random slopes model (lower aic, bic, and very high bayes factor) BUT then when I look at $r_squared_change it seems like the random slopes model explains much more variance (since the R^2 change is a negative number)? Is that the correct interpretation or have I got something wrong here?
3:54 "we want to fit a fixed slope as well as a random slope" should be "we want to fit a fixed intercept as well as a random intercept", right?
which version of R do you have, because mine doesn't install flexpot package
@QuantPsych
2 жыл бұрын
Are you installing through github? install.packages("devtools") devtools::install_github("dustinfife/flexplot")
Thank you for your nice videos. Where can I get the data set you are using in this video?
@QuantPsych
2 жыл бұрын
It's embedded in the flexplot package.
When I load flexplot it says: Warning in install.packages : package ‘flexplot’ is not available (for R version 4.0.0)
@QuantPsych
2 жыл бұрын
I'd post an issue on github (github.com/dustinfife/flexplot)
Thank you for your awesome videos and packages! You are lifesavers and all concepts are clearly explained. But when I tried to rerun the code "visualize(baseline,plot = "model"), there is an error: `_inherit` must be a ggproto object. I am not sure why, thank you for your help!
@QuantPsych
2 жыл бұрын
what version of flexplot are you using? Also, maybe show me the code where you create baseline.
@mingjingchen1238
2 жыл бұрын
@@QuantPsych I am using flexplot (0.11.3), and I used the same code as yours for baseline: baseline=lmer(MathAch~1+(1|School), data = math), error:`_inherit` must be a ggproto object., is it because I used the previous version of flexplot? Except for visualizing baseline, other functions of flexplot work perfect. Thank you for your prompt response. :)
@mingjingchen1238
2 жыл бұрын
Today I tried my flexplot again and it works now! Thank you for developing such a wonderful package!
The command "visualize(baseline, clusters=3)" generates: Error in compare.fits(formula, data = k, model1 = object, model2 = object, : formal argument "clusters" matched by multiple actual arguments. My baseline is a result of lmer function (i.e. baseline=lmer(data=data.it, y~1+(1|subject)). The visualize function produced same error for various values of cluster. When I omit the cluster, I get the graphic.
@QuantPsych
3 жыл бұрын
Well dang. I'll make a note to investigate this.
Hi! , you conclude that SES needs to be included as a FIXED effect (hence a fixed slope ). Then you add minority to the model/ However, in the model "minority" you have added SES to have a random intercept and slope per school (SES | school) . Shouldt you add have the model to be minority_fixed
How can we take classes with you?
@zimmejoc
Жыл бұрын
he just posted a new vid a couple days ago where you can take a class with him in the near future.
@bumblebee7597
Жыл бұрын
@@zimmejoc thank you so much!
Hello. On 14.35, did you mean to say that school doesn't have any NON-minorities?
@QuantPsych
2 жыл бұрын
Yes. Good catch!
Great explanation! However I'm sure the minority kids in the dataset didn't include indian American kids! 😂