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

  • @SagangaKapaya
    @SagangaKapaya2 жыл бұрын

    Thanks very much, your illustrations are very clear.

  • @dewidinevandercolff3999
    @dewidinevandercolff3999 Жыл бұрын

    You make these things cool! Thanks! I am subscribing!

  • @srensommer3434
    @srensommer34342 жыл бұрын

    And also,you are sharing music theme with It's allways sunny in Philadelphia - Also brings a smile..

  • @andriismykovskyi2999
    @andriismykovskyi29992 жыл бұрын

    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

  • @Pmonfrost
    @Pmonfrost Жыл бұрын

    Thanks!

  • @izzthewizz6
    @izzthewizz62 жыл бұрын

    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.

  • @Jonathan-zd6ns
    @Jonathan-zd6ns2 жыл бұрын

    Dear professor, can I ask how to show p value for the beta coefficient in summary functions??? Thanks !!!

  • @luismiguelloperaparra5994
    @luismiguelloperaparra59943 жыл бұрын

    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?

  • @annawassel1247
    @annawassel12472 жыл бұрын

    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?

  • @alsayer8726
    @alsayer8726 Жыл бұрын

    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?

  • @brazilfootball
    @brazilfootball Жыл бұрын

    What does an $icc output of "[1] 1, $design.effect [1] 13.42553" mean?

  • @MegaSesamStrasse
    @MegaSesamStrasse2 жыл бұрын

    what would a random effect of the variable minority mean? and why wasn't it tested?

  • @hm.91
    @hm.912 жыл бұрын

    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

    @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.

  • @morriskrainz3997
    @morriskrainz39972 жыл бұрын

    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?

  • @FilippoGianburrasca
    @FilippoGianburrasca5 ай бұрын

    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?

  • @francescamalcangi8221
    @francescamalcangi82212 жыл бұрын

    which version of R do you have, because mine doesn't install flexpot package

  • @QuantPsych

    @QuantPsych

    2 жыл бұрын

    Are you installing through github? install.packages("devtools") devtools::install_github("dustinfife/flexplot")

  • @srishtitripathi8543
    @srishtitripathi85433 жыл бұрын

    Thank you for your nice videos. Where can I get the data set you are using in this video?

  • @QuantPsych

    @QuantPsych

    2 жыл бұрын

    It's embedded in the flexplot package.

  • @annaferrusolapastrana2516
    @annaferrusolapastrana25163 жыл бұрын

    When I load flexplot it says: Warning in install.packages : package ‘flexplot’ is not available (for R version 4.0.0)

  • @QuantPsych

    @QuantPsych

    2 жыл бұрын

    I'd post an issue on github (github.com/dustinfife/flexplot)

  • @mingjingchen1238
    @mingjingchen12382 жыл бұрын

    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

    @QuantPsych

    2 жыл бұрын

    what version of flexplot are you using? Also, maybe show me the code where you create baseline.

  • @mingjingchen1238

    @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

    @mingjingchen1238

    2 жыл бұрын

    Today I tried my flexplot again and it works now! Thank you for developing such a wonderful package!

  • @tatjanajak
    @tatjanajak3 жыл бұрын

    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

    @QuantPsych

    3 жыл бұрын

    Well dang. I'll make a note to investigate this.

  • @rutgervanbasten2159
    @rutgervanbasten2159 Жыл бұрын

    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

  • @bumblebee7597
    @bumblebee7597 Жыл бұрын

    How can we take classes with you?

  • @zimmejoc

    @zimmejoc

    Жыл бұрын

    he just posted a new vid a couple days ago where you can take a class with him in the near future.

  • @bumblebee7597

    @bumblebee7597

    Жыл бұрын

    @@zimmejoc thank you so much!

  • @AmanzholBekmagambetov
    @AmanzholBekmagambetov2 жыл бұрын

    Hello. On 14.35, did you mean to say that school doesn't have any NON-minorities?

  • @QuantPsych

    @QuantPsych

    2 жыл бұрын

    Yes. Good catch!

  • @bumblebee7597
    @bumblebee7597 Жыл бұрын

    Great explanation! However I'm sure the minority kids in the dataset didn't include indian American kids! 😂