t-test and interpreting p values using R Programming

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

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

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

    Get my FREE cheat sheets for R programming and statistics (including transcripts of these lessons) here: www.learnmore365.com/courses/rprogramming-resource-library

    • @oluderaolumide2003
      @oluderaolumide2003 11 месяцев назад

      I will like you to seperate the statistics analysis from business analysis

  • @Shawn-gm4cf
    @Shawn-gm4cf 2 года назад +24

    I can't say this enough, but please keep making these. I'm hoping I can use your videos to supplement my own stats classes in the future, because they really are great at getting at the meat and potatoes of both the code and theory behind the stats.

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

    Thanks so much for making this. I've been watching dozens of videos, and none of them explain how to extract the values from the t-test for inline coding like here! MVP

  • @ImLeviathan
    @ImLeviathan 7 месяцев назад

    as a total newbie in statistics and trying to learn by myself this video has helped a lot. Thanks for coupling up explanations of code and basic concepts in statistics. Very much appreciated!

  • @thomassauv1893
    @thomassauv1893 2 года назад +10

    As a PhD candidate, your videos helped a lot. Very efficient. Thanks a lot.¨Please continue with other statiscal tests ;)

  • @javiermonroy4616
    @javiermonroy4616 2 года назад

    Jesus Christ, this channel just keeps getting better and better. Thanks for the content!

  • @daniellarkins7743
    @daniellarkins7743 2 года назад +4

    Great video, I'm just starting with R and your videos have been great. The explanations of the codes you provide is fantastic. Keep up the awesome work.

  • @AmitYadav-ee7sz
    @AmitYadav-ee7sz 2 года назад

    I hope you will never stop making videos on R........as far as R is in trend.

  • @AmitYadav-ee7sz
    @AmitYadav-ee7sz 2 года назад

    one of the best R programming teacher.....love you

    • @RProgramming101
      @RProgramming101  2 года назад

      You are too sweet Amit - thanks! More R videos to come of course! ☺

  • @janinemashny525
    @janinemashny525 2 года назад

    I love how excited he is to talk about R!!

    • @RProgramming101
      @RProgramming101  2 года назад

      So nice of you, Janine. Thank you for your feedback!

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

    One of the best t-test and p-values in YT!

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

    Great as usual. I can't wait to see the next video. Thanks for the great work.

  • @vipeeera007
    @vipeeera007 2 года назад +12

    Great video. Could you please also start sharing the code to produce the graphs you use to visualize the concepts you speak about?

    • @Sir-Mighty-Mike
      @Sir-Mighty-Mike 2 года назад +1

      I was able to figure out how to do the first graphic at 5:26
      ggplot(data = ) +
      geom_density(mapping = aes(lifeExp), fill = "red", alpha = 0.2) +
      geom_vline(xintercept = mean($lifeExp), color = "red", alpha = 0.4, linetype = "dashed", size = 1.5)

    • @Sir-Mighty-Mike
      @Sir-Mighty-Mike 2 года назад +3

      I was able to figure out how to recreate the 2nd graph too! (not perfect, but pretty close)
      ggplot(data = ) +
      geom_density(aes(lifeExp, color = continent, fill = continent), alpha = 0.3) +
      geom_vline(xintercept = 48.9, color = "red", alpha = 0.4,
      linetype = "dashed", size = 1.2) +
      geom_vline(xintercept = 71.9, color = "cyan4", alpha = 0.4,
      linetype = "dashed", size = 1.2) +
      labs(
      title = "Density Plot of Life Expectency in Africa and Europe",
      y = "",
      x = "Age in yrs") +
      annotate(
      "text", x = 43, y = 0.075, label = "48.9 yrs", color = "red",
      alpha = 0.8, size = 4.5) +
      annotate(
      "text", x = 80, y = 0.075, label = "48.9 yrs", color = "cyan4",
      alpha = 0.8, size = 4.5)
      **NOTE**
      The data frame I had loaded was gapminder filtered(continent %in% c("Africa", "Europe"))

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

    Thanks a lot! As usual, the explanation was amazing! I used to get confused in t-test but this complicated stuff you have made it so easy!

  • @thulfiqaral-graiti7131
    @thulfiqaral-graiti7131 2 года назад +2

    Would be possible to show in the future data analysis episodes the following matters: 1- A decision about making numeric variables as factor or leave it as a numeric as well as how about incase having categorical variables?
    2- What the best decision can be made to deal with data having missing values (NA)?
    As always you made things enjoyable as the best, thanks alot!

    • @RProgramming101
      @RProgramming101  2 года назад +4

      Will do!! I have a video on missing data using R on my Global Health channel (go to global health with greg martin and you'll find it there)

  • @rupeshingle2681
    @rupeshingle2681 2 года назад

    Thank you sir for proving this important and beautiful knowledge, I love the way you teach.
    Thank you again

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

    Another great one in the bag. Great job!

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

    Thanks for sharing this Greg. It's incredibly helpful

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

      Glad it was helpful!

    • @jamesleleji6984
      @jamesleleji6984 2 года назад

      @@RProgramming101 Please remember to do a tutorial on difference in differences between a control and experimental group. Thanks

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

    Learning so much from your videos!

    • @RProgramming101
      @RProgramming101  2 года назад

      I'm so glad! Thanks for the feedback, Hernan. Much appreciated.

  • @biologycorner1
    @biologycorner1 2 месяца назад

    Book shaka laka to you for making these great videos...please keep posting

  • @AnupKumar-nz2qq
    @AnupKumar-nz2qq 2 года назад +1

    Thank you for explaining in this beautiful manner

  • @Undefined0701
    @Undefined0701 Месяц назад +3

    Guys does anyone know why I get this error for the paired test: " Error in t.test.formula(lifeExp ~ year, data = ., paired = TRUE) :
    cannot use 'paired' in formula method "

    • @mindfvck1
      @mindfvck1 Месяц назад

      Did you figure out how to troubleshoot that issue I'm also experiencing the same issue?

    • @MohammedNma
      @MohammedNma 18 дней назад +1

      Having this same error

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

    you are simply awesome Greg i learn alot from You....Thanks to my GURU( means teacher in hindi)

  • @etm9703
    @etm9703 2 года назад

    Great video! Helped me with my R lab homework, thank you!!

  • @Sir-Mighty-Mike
    @Sir-Mighty-Mike 2 года назад

    I really appreciate you making these videos! They are really helpful!

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

    I really enjoyed your videos. As always. Thx for making this great video explanation.

  • @romanvasiura6705
    @romanvasiura6705 2 года назад

    Thank you for this great video!
    It's so fan to look how easy you do it))
    Hopefully I'll find more materials in your other resources!

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

      Of course, more to come, Roman. Thank you for the amazing feedback!

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

    Great video. But it will greatly be appreciated if you can share the codes for the graphs?

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

    Great video, could you comment a little more about the example you have used for paired t-test? One could guess that the sample used for individuals in 1957 is not the same than that in 2007 even if it is the same continent. The two samples could be considered independent from each other. I other words that we are not using repeated or matched measurements of life exp. and could safely use a two-sample t-test instead of a paired one. Thank you so much.

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

      Very interesting observation Mauro. I hadn't thought of that. I think however that in this case, what is being sampled are countries (not individuals). It is the countries that are matched. But its an interested thought and I'll muse over your comment a little.

  • @Md.RabiulIslamRubel
    @Md.RabiulIslamRubel 8 месяцев назад

    Thanks for such a great and clear explanation. Could you mind making a video on 'how to visualize the T-test result'?

  • @FengChin-v6f
    @FengChin-v6f 9 месяцев назад

    5:49 hypothesis test
    10:51 test for difference of mean (two side test)
    17:50 test for difference of mean (one side test)

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

    work of a genius

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

    Thanks for the video. Do you have one that discusses the density plots you created for life expectancy? This is an excellent series, btw.

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

    you are great teacher
    🤩🤩

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

    Thank you for this. I have seen a lot of people turning to a KW test in R. Can you go over when that is appropriate?

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

    bonus learning objective, the dot for piping when it's not the first part of a formula - not what I came to learn but super important point (pun intended)

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

    Great video. Thank you so much

  • @sintubmb
    @sintubmb 2 года назад

    You are the best, as always. But you could have explained the code for the density plot too. Or have I missed it?

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

    please make vedios about principal component analysis in R

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

    Can you please share how to create those plots that u were showing during the start of the video

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

    Hello, Greg! Thank you for sharing this video!
    I have one question about the plots though - how did you display M on each density plot, and how did you manage to put the plots together?

    • @RProgramming101
      @RProgramming101  5 месяцев назад +1

      ah - thanks for the questions (good ones). Hard to answer in the comments but I will make a video that explains. Watch this space. Happy day. Greg

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

      @@RProgramming101 Wonderful, thank you! All the best:)

  • @Duncanwg7
    @Duncanwg7 2 года назад

    Great video. A video on testing data for different distributions would be nice, such as normal, weibull etc.

  • @thedude870
    @thedude870 2 года назад

    Isn‘t the difference in life expectancy statistically significant when you compare Ireland to Switzerland because you don‘t compare it only for one year but for say the last 30 years?
    Or maybe a general question: Does statistical significance change when you compare more than one event?

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

    Can you explain how you did create plots for t.test?

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

    Can you please do more videos about all tests, and linear and logistic regressions? Other than that, awesome videos, thank you very much!

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

      Great suggestion! Thank you for the feedback.

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

    I get u lound and clear in this remote place in Africa.
    Good teaching
    Please how did u draw the graphs?

    • @mashfintech
      @mashfintech 2 года назад

      What village are you in? Kikikikiki

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

      @@mashfintech Yamumbi

    • @mashfintech
      @mashfintech 2 года назад

      @@mugomuiruri2313 nice one brother. I am in Pretoria South Africa hiding from dudula.

    • @sciencefliestothemoon2305
      @sciencefliestothemoon2305 2 года назад

      They are density plots, easy to make, I just havent figured out the vertical line yet.
      gapminder%>%
      filter(continent %in% c("Africa", "Europe"))%>%
      ggplot(aes(x=lifeExp,
      color=continent,
      fill=continent))+
      geom_density(alpha = 0.2)
      gives you the basic graph

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

      @@sciencefliestothemoon2305
      gapminder%>%
      filter(continent %in% c("Africa", "Europe"))%>%
      ggplot(aes(x=lifeExp,
      color=continent,
      fill=continent))+
      geom_density(alpha = 0.2)+
      geom_vline(xintercept = 50, linetype="dashed",
      color = "red", size=0.8) #50 or mu is the median of population in your test

  • @karikoga320
    @karikoga320 2 года назад

    Great video. Can you please work on Two One Sided T test (TOST) video which is quite prevalent and widely used in the pharmaceutical industry. Also please address the issue of statistical significance versus practical significance.Thank you

    • @RProgramming101
      @RProgramming101  2 года назад

      Great suggestion! Thank you for the feedback.

  • @aaronmombos
    @aaronmombos 2 года назад

    This is great! I'm new to R and new to statistics and your channel is very helpful! A question, if using t-tests to determine significance in product price changes, would you use a double sided, single sided test, or paired test? Thank you!

  • @nandecomics
    @nandecomics 2 года назад

    Where do you get tidyverse, patchwork and gapminder? I'm using RStudio at the moment.

  • @QuyNguyen-w1r
    @QuyNguyen-w1r 9 месяцев назад

    thanks! This is a great help!

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

    Hello, I tried to follow but it does not find the gapminder. I have many issues with R not finding library vocabularies. Also error on %>% function.

    • @Yourmom-vu5ct
      @Yourmom-vu5ct Год назад

      I had that issue too and I downloaded the following packages for the function. Maaybe they work for you
      install.packages("magritter")
      install.packages("dplyr")

  • @mbmathematicsacademic7038
    @mbmathematicsacademic7038 2 месяца назад

    Based on my experience,it is much better to perform inferential statistics in R rather than in Python......

  • @paulbishop1641
    @paulbishop1641 2 года назад

    great videos thank you - would you be able to do something on how to work with skewed data

  • @elispot17
    @elispot17 2 года назад

    Such a great video, can I have that R script?

  • @ManuelLopez-ej8sn
    @ManuelLopez-ej8sn 2 года назад

    Ty Greg for yet another great vdo. Two questions.
    1) How do you get the two vlines representing the two countries means in the graph?
    2) I tried Levene’s test. What is wrong with this code?
    library(car)
    gapminder %>%
    filter(country %in% c("Ireland", "Switzerland")) %>%
    leveneTest(lifeExp, country, center = mean)
    Can’t figure out either of those 😊

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

      will try to make a video that addresses this.

    • @ManuelLopez-ej8sn
      @ManuelLopez-ej8sn 2 года назад

      @@RProgramming101 Looking forward to that! Thank you very much

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

      To answer your question 1, use (geom_vline) at the end of your ggplot code, this is an example using the GAPMINDER dataset:
      gapminder %>%
      select(continent, lifeExp) %>%
      filter(continent == 'Europe') %>%
      ggplot(aes(x = lifeExp))+
      geom_density(fill ='orange', alpha = 0.5)+
      geom_vline(aes(xintercept = mean(lifeExp)),linetype = 'dashed')

    • @ManuelLopez-ej8sn
      @ManuelLopez-ej8sn 2 года назад +1

      @@souhaibsebbane5623 Thank you very much for your helpful answer! I'm going to try this out right away.

  • @SNAKE1375
    @SNAKE1375 2 года назад

    Thanks Greg, I can clearly see the use of the t-test to compare two means. But I still don't understand the first example. Why testing a population if we already know its mean? and also what is the use to "sample" it to make a test?

    • @RProgramming101
      @RProgramming101  2 года назад +3

      Hi Francois - great question. In the fist example, we're comparing our sample data mean to some hypothesised mean (which may be because of previous studies or assumptions). We may, for example, all believe that Irish men are on average 6 foot tall. We can take a sample of men, measure the mean and ask if it is different from that asumptions (the 6 feet)

  • @kouakouvalerekouassi673
    @kouakouvalerekouassi673 2 месяца назад

    Hello sir
    Can't find the package 'gapminder ' in R

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

    Thanks for sharing

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

    Thank you sir!

  • @dextermorgan245
    @dextermorgan245 3 месяца назад

    BEST VIDEO

    • @RProgramming101
      @RProgramming101  2 месяца назад

      wow - thanks for the feedback (much appreciated)

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

    Life-saver ❤

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

      I'm thrilled that my video helped you or provided you with useful information. Thanks for letting me know!

  • @ecc6975
    @ecc6975 2 года назад

    Hi there, I have followed your instructions for the examples:
    gapminder %>%
    filter(continent == "Africa") %>%
    select(lifeExp) %>%
    t.test(mu = 50)
    as well as
    my_ttest %
    filter(continent == "Africa") %>%
    select (lifeExp) %>%
    t.test (mu = 50)
    however both come up with:
    Error in select(., lifeExp) : unused argument (lifeExp)
    Would you know what could be the cause of this and how to fix it by any chance?

    • @ilkyen
      @ilkyen 2 года назад

      dplyr::select(lifeExp) %>%
      #MASS and dplyr package Select function clashes, so we tell R to use dplyr

    • @felipem8639
      @felipem8639 2 года назад

      First you need to load the data:
      install.packages("patchwork")
      library(patchwork)
      and if want, you cant attach the data so you dont need to call the data all the time:
      attach(gapminder)
      and if you want to create a object to work with it:
      data("gapminder")
      name_your_data

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

    It is not just simplest to give the 95% confidence interval rather than the p-value. Thus nipping the p-hacking business in the...? There seems to be far too much confusion around the p-values.

    • @RProgramming101
      @RProgramming101  2 года назад

      Good question. The truth is that there are so many ways that people p hack (even without knowing it). It’s a big problem. The best way forward is to make people aware of it.

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

    Why can't I install the packages after typing install.packages(patchwork) and install.packages(gapminder)? :(

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

    very clear

  • @sciencefliestothemoon2305
    @sciencefliestothemoon2305 2 года назад

    That might be a stupid question, but how to I create the vertical line for the mean in the graphs?

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

    Thank you

  • @ramoda13
    @ramoda13 11 месяцев назад

    nice video thank u

  • @SC-bi6my
    @SC-bi6my 2 года назад

    Hi, what statistics packages you are using? Can you share your R file?

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

      Will find a way to get the script for you.

  • @petfield100
    @petfield100 11 месяцев назад

    One sided test for two different means: alway s the error: groupng factor must have two Steps?

  • @jamie10157
    @jamie10157 2 года назад

    boom shakalaka - we did this!

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

    May I know he source for DATA?

  • @medicalmarvels976
    @medicalmarvels976 11 месяцев назад

    Error: unexpected symbol in:
    "gapminde %>%
    filter(continent %in% c("Africa"."
    >

  • @boojaado
    @boojaado 8 месяцев назад

    This is the 'analyze' tutorial.

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

    Please pump up loudness next time.

  • @matp3209
    @matp3209 2 года назад

    7:32 the P value is not a probability, it’s just a number

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

    Chacalaca

  • @m.arijuanto9821
    @m.arijuanto9821 2 года назад

    I don't understand