Chi-Squared Testing for Independence in R

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • Let's learn how to use the chisq.test() function in R to check the independence of categorical variables.
    If this vid helps you, please help me a tiny bit by mashing that 'like' button. For more #rstats joy, crush that 'subscribe' button!

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

  • @motomarx
    @motomarx 10 месяцев назад +2

    Clear and concise -- thanks

  • @sydneyklein7957
    @sydneyklein7957 3 года назад +7

    Great video! I am wondering how you would interpret the results of the chi-square using this specific example?

    • @EquitableEquations
      @EquitableEquations  3 года назад +3

      Thanks! In this example, the p-value is very small, so it's likely that these categorical variables are associated (ie, not independent). Here's a vid about the test itself: ruclips.net/video/tnmmCFv63s8/видео.html

  • @romanvasiura6705
    @romanvasiura6705 Год назад +1

    Thank you!

  • @huseyintoptay9666
    @huseyintoptay9666 Год назад +1

    amazing !

  • @AliceHuang-cm5cy
    @AliceHuang-cm5cy Год назад +2

    Thanks for you video! But how to do chi square test with multiple covariants?

  • @trashflora
    @trashflora 14 дней назад

    Hello! Thank you so much for this its really clear and helpful!
    so i was wondering, lets say i want to know if 5 kinds of animals randomly locate in 5 places or they are associated with the crops, I do this test and get a p-value, can i pairwise and continue see what exact crop associate with the carcasses? I dont know whether the pairwise is for independence test or for homogeneity test

  • @abidanwr
    @abidanwr 2 года назад +2

    Hi ,
    I like all your videos they all are so informative and easy to understand .
    I have a question if I need to draw a histogram of number of day and days categorized in three groups, how can we do so?

    • @EquitableEquations
      @EquitableEquations  2 года назад +1

      Hi! This should get you started: ruclips.net/video/FAvESE3WC30/видео.html

  • @manuelleitner1996
    @manuelleitner1996 3 года назад +3

    Thank you for your great video! But you would you calculate post-hoc analysis here? :)

    • @EquitableEquations
      @EquitableEquations  3 года назад +3

      Yes! I’m working on this vid now. Hopefully I’ll be able to post it within the month.

    • @manuelleitner1996
      @manuelleitner1996 3 года назад +1

      @@EquitableEquations that sounds great! Thank you very much. :)

  • @amalnasir9940
    @amalnasir9940 3 года назад +3

    Thank you for the video. What about the adjusted residuals? Is there a way to calculate that in R?

    • @EquitableEquations
      @EquitableEquations  3 года назад +1

      model$stdres will give you standardized residuals, but chisq.test doesn't include adjusted ones. Sigh.

    • @amalnasir9940
      @amalnasir9940 3 года назад +1

      @@EquitableEquations Interesting. I calculated the adjusted residual manually and got the same results as model$stdres in R.

    • @amalnasir9940
      @amalnasir9940 3 года назад +3

      I want to add an important point here. From R documentation, model$residuals is a Pearson residuals = (observed - expected) / sqrt (expected). model$stdres = (observed - expected) / sqrt (V), where V is "the standard error, SE" = expected*(1- row total) * (1-column total), and that "model$stdres" gives us the adjusted residuals.

  • @nolomotlhabi
    @nolomotlhabi Год назад +1

    THANK YOU! I followed through with everything you did in the video. when i ran the test for my research paper i got a message saying "Warning message:
    In chisq.test(volunteers): Chi-squared approximation may be incorrect", what caused it? is there a way I can fix this? please help.

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

      Hi! This warning comes up when at least one expected cell counts is very small, potentially making the chi-squared approximation inaccurate. Often it's ok to ignore this warning, but in more extreme cases you'd want to switch to the Fisher exact test.

    • @nolomotlhabi
      @nolomotlhabi Год назад +1

      @@EquitableEquations Makes sense. Thank you

  • @MeyankaBaishya
    @MeyankaBaishya 16 дней назад

    how do we proceed if the sample size for "Type of volunteer" is different in each case and the available data is in percent form ?

  • @user-cn1br8zt7q
    @user-cn1br8zt7q 9 месяцев назад

    Very interesting. I tried this for the dataset mydat

    • @EquitableEquations
      @EquitableEquations  9 месяцев назад

      Depends whether you want the continuity correction or not, lol. There's a reason the default is TRUE ;-) Anyhow the numbers are usually very close to one another.

    • @user-cn1br8zt7q
      @user-cn1br8zt7q 8 месяцев назад

      @@EquitableEquations Thanks for the response. My teachers was showing us how to do it by hand in an excel sheet and in order for the answers to lign-up I had to change correct to false. Aced the course though.

  • @r.dhrwin4665
    @r.dhrwin4665 7 месяцев назад

    why there no "volunteer" option when i type in my rstudio?