{emmeans} Game-Changing R-package Squeezes Hidden Knowledge out of Models!

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • {emmeans} is one of the most capable, but at the same time one of the most mysterious and therefore underrated R packages. Let’s demistify {emmeans} and uncover it’s power!
    If you only want the code (or want to support me), consider join the channel (join button below any of the videos), because I provide the code upon members requests.
    The cartoon illustrations for Type I and Type II Errrors were created by Allison Horst.
    Enjoy! 🥳

Комментарии • 31

  • @MaxwellSeale
    @MaxwellSeale Год назад

    My savior! I've been looking for exactly this to interpret my mixed model!

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад

      Thanks, mate! Yeah, I love emmeans and use it all the time for the mixed models. There is a special post for exotic model, including "lmer", if you still didi not find it: cran.r-project.org/web/packages/emmeans/vignettes/sophisticated.html#offsets

  • @craighansen2818
    @craighansen2818 10 месяцев назад +1

    Another great video, well done,! Thanks for all the effort you put into creating great content and visualisations that help explain many of the complex topics.
    As other viewers have mentioned on your videos, you should consider creating an online course.

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  10 месяцев назад

      Much appreciated! Sure, I am thinking about making a course on R. But the day job keeps me busy. That's actually why the videos come out so rare. But yeah, it will come in the future for sure. Thanks for your support!

  • @alelust7170
    @alelust7170 Год назад

    Man, tks a lot... You could create an advanced online R course on these concepts and applications. this is just amazing!

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад +1

      Maybe one day! Until then I’ll create more useful content. Thanks for watching!

  • @ibrahimlawan9663
    @ibrahimlawan9663 Год назад

    Unbelievable!
    Thanks a lot.

  • @mylifeisinhishandsamen4167
    @mylifeisinhishandsamen4167 5 месяцев назад

    Thank you!

  • @bj3768
    @bj3768 Год назад

    Good content as always

  • @siriyakcr
    @siriyakcr Год назад

    Drill down approach 🥰🥰🥰🥰,

  • @mylifeisinhishandsamen4167
    @mylifeisinhishandsamen4167 5 месяцев назад

    I wonder if we could do grouped bar chart for this. I have a three-way mixed effect ANOVA that I have estimated with emmeans.

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  5 месяцев назад

      I am not sure a grouped bar chart is the best solution. I did a video on barplots and talk about why I don’t like them. But they are possible. I would recommend to use plot_model function from sjPlot package, I also did a video on sjPlot

  • @nikodemderengowski4243
    @nikodemderengowski4243 Год назад

    Fantastic, thank you! I have been looking for an understandable explanation of the different outputs of emmeans for a while now and your video is thorough and straight to the point, in an easily-digestible way. Though I am still struggling to grasp what the t ratio is used for there (and how to calculate it?)

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад

      Hey, thanks for a nice feedback! And thanks for watching! I absolutely love emmeans package and use it everyday, so, that's why I thought that it might be useful to others. I try to explain the t-ratio here:
      The t-ratio is a measure of the difference between two means, divided by the standard error of the difference. It is used in hypothesis testing to determine whether the difference between two means is statistically significant.
      The t-ratio is calculated as follows:
      t = (mean1 - mean2) / se(mean1 - mean2)
      where:
      The t-ratio is a ratio of the difference between the means to the standard error of the difference. The larger the t-ratio, the more likely it is that the difference between the means is statistically significant.
      The t-ratio is calculated because it is a more reliable measure of the difference between two means than the difference itself. The difference between two means can be affected by sampling error, which is the random variation that occurs when we sample a population. The standard error of the difference is a measure of sampling error, and it is used to adjust the difference between the means to account for sampling error.
      The t-ratio is a useful tool for hypothesis testing, but it is important to remember that it is only a measure of statistical significance. It does not tell us anything about the practical significance of the difference between the means. The practical significance of a difference is determined by the magnitude of the difference and the context in which it occurs.
      cheers

    • @nikodemderengowski4243
      @nikodemderengowski4243 Год назад

      ​@@yuzaR-Data-Science wow, thanks a lot for this quick response! I think I understood it well now :) - the t-ratio in the EMMs (first table output) doesn't make much senes as we don't compare stuff, but in the contrast analysis it gives a nice hint, if read together with the p-value. If that's not too much...could you also give a suggestion on what could be the reason why overlapping "red arrows" on the plot still give out a significant p-value? Such was the case in my example dataset.

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад +1

      you are welcome. overlapping is tricky. it highly depends on sample size, whether measures are dependent or not, is the data clear, or has outliers etc. so, overlapping, similar to the p-values are good hints to what might be. we need several hints, like p-values, CIs, effect sizes, bayes factors t-ratios etc. think about it this way: not 100% clear model results are much better then no results at all. thus, the emmeans package is amazing at giving us hints and helping to interpret results, but it's not always super clear and correct, like any statistical method. hope that helps!

    • @nikodemderengowski4243
      @nikodemderengowski4243 Год назад

      @@yuzaR-Data-Science It does help a lot, thank you for all the inputs!

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад

      @@nikodemderengowski4243 you are welcome! thank you for watching!

  • @hansmeiser6078
    @hansmeiser6078 Год назад +2

    How can we get variable-importance of predictors with emmeans on a rq()-fit in regressions?

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад

      what do you mean by "variable-importance"? emmeans does not actually measure the importance of variable ... random forest does

    • @hansmeiser6078
      @hansmeiser6078 Год назад

      @@yuzaR-Data-Science
      *chatGPT* told me the following... One way to obtain variable importance is to use the summary() function on the fitted model object. This will give you the estimated coefficients and their standard errors, which can be used as a measure of variable importance.
      If we could do so, then the question is, where can we find standard errors and estimated coefficients with emmeans. I already saw standard errors in your video, but I'm not sure about the estimated coefficients.
      If we could do so, it would also be an approach for models, which do not have any generic variable importance output in general, like brms multilevel etc. *Am I wrong?* I'm also trying broom in this direction. I believe, emmeans and broom have a different list of supported models.

  • @luisa1551
    @luisa1551 4 месяца назад

    Could you add the credits for the images you use? Like the cartoons for type I and type Ii errors. I have seen them before and I think they are under CC-BY 🧐

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  4 месяца назад

      O MY GOD, you are totally right! I am so sorry! I used the earlier pics of Allison Horst before, where her name was already on the picture (as twitter profile-name), so I forgot to care about this. Thanks for noticing, Luisa. I am not sure I can edit already published videos, but I added the reference from Allison to the description of two ob my videos, where I know I used videos. In the current video I am doing right now, I included a title on top of the pictures: "Artwork by Allison Horst". Hope that reduces the damage a bit. Kind regards!

  • @zane.walker
    @zane.walker Год назад

    Interesting. I have not encountered marginal means before, so thanks for bringing them to my attention. Do the assumptions of normality and homoscedasticity of the data also apply? Is this just a more convenient alternative to using a function like ggbetweenstats to compare the groups?

    • @yuzaR-Data-Science
      @yuzaR-Data-Science  Год назад +1

      sure, you are welcome! :) ... since emmeans just pulls the information our of models, no assumptions checks are needed. When you have an adequate model, after you have checked the assumptions, you'll get the emmeans from this correct model. It's a much more convinient way to get info from the model, so, if the model is simple, like anova, then the emmeans is similar to ggbetweenstats, but we need modelling for more complex ideas. There, summary command simply does not deliver, while emmeans does! :)