t-test and interpreting p values using R Programming

  Рет қаралды 85,776

R Programming 101

R Programming 101

Күн бұрын

This video explains how to use a t-test and interpret the p value using R programming. If you are doing data analysis or interested in data science, then you'll need to learn how to do statistical analysis. Statistics and statistical inference is easy when you know how. If you're doing any kind of quantitative rsearch, then this is a must.

Пікірлер: 138
@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 7 ай бұрын
I will like you to seperate the statistics analysis from business analysis
@Shawn-gm4cf
@Shawn-gm4cf 2 жыл бұрын
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.
@RProgramming101
@RProgramming101 2 жыл бұрын
Thank you for the feedback!
@ImLeviathan
@ImLeviathan 3 ай бұрын
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!
@KathySolita
@KathySolita 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
@RProgramming101
@RProgramming101 2 жыл бұрын
You're very welcome!
@daniellarkins7743
@daniellarkins7743 2 жыл бұрын
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.
@RProgramming101
@RProgramming101 2 жыл бұрын
Awesome, thank you!
@muhammedhadedy4570
@muhammedhadedy4570 2 жыл бұрын
Great as usual. I can't wait to see the next video. Thanks for the great work.
@RProgramming101
@RProgramming101 2 жыл бұрын
Thanks again!
@thomassauv1893
@thomassauv1893 2 жыл бұрын
As a PhD candidate, your videos helped a lot. Very efficient. Thanks a lot.¨Please continue with other statiscal tests ;)
@RProgramming101
@RProgramming101 2 жыл бұрын
Thanks, will do!
@TakeFlow1
@TakeFlow1 2 жыл бұрын
@@RProgramming101 Yes!
@javiermonroy4616
@javiermonroy4616 2 жыл бұрын
Jesus Christ, this channel just keeps getting better and better. Thanks for the content!
@RProgramming101
@RProgramming101 2 жыл бұрын
Wow, thanks! So nice of you, Javier 😁
@michaelmillett1478
@michaelmillett1478 Жыл бұрын
I really appreciate you making these videos! They are really helpful!
@RProgramming101
@RProgramming101 Жыл бұрын
Glad you like them! You are so welcome!
@jd5481
@jd5481 2 жыл бұрын
Another great one in the bag. Great job!
@RProgramming101
@RProgramming101 2 жыл бұрын
Thanks 👍🏻
@rupeshingle2681
@rupeshingle2681 2 жыл бұрын
Thank you sir for proving this important and beautiful knowledge, I love the way you teach. Thank you again
@RProgramming101
@RProgramming101 2 жыл бұрын
It's my pleasure
@romanvasiura6705
@romanvasiura6705 Жыл бұрын
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 Жыл бұрын
Of course, more to come, Roman. Thank you for the amazing feedback!
@user-gp9vu7mw9r
@user-gp9vu7mw9r 5 ай бұрын
thanks! This is a great help!
@janinemashny525
@janinemashny525 Жыл бұрын
I love how excited he is to talk about R!!
@RProgramming101
@RProgramming101 Жыл бұрын
So nice of you, Janine. Thank you for your feedback!
@AmitYadav-ee7sz
@AmitYadav-ee7sz Жыл бұрын
I hope you will never stop making videos on R........as far as R is in trend.
@etm9703
@etm9703 Жыл бұрын
Great video! Helped me with my R lab homework, thank you!!
@RProgramming101
@RProgramming101 Жыл бұрын
You're very welcome! Glad it was helpful!
@LearningAddict
@LearningAddict 2 жыл бұрын
I really enjoyed your videos. As always. Thx for making this great video explanation.
@RProgramming101
@RProgramming101 2 жыл бұрын
Glad you enjoyed it!
@AmitYadav-ee7sz
@AmitYadav-ee7sz Жыл бұрын
one of the best R programming teacher.....love you
@RProgramming101
@RProgramming101 Жыл бұрын
You are too sweet Amit - thanks! More R videos to come of course! ☺
@jamesleleji6984
@jamesleleji6984 2 жыл бұрын
Thanks for sharing this Greg. It's incredibly helpful
@RProgramming101
@RProgramming101 2 жыл бұрын
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 жыл бұрын
Learning so much from your videos!
@RProgramming101
@RProgramming101 2 жыл бұрын
I'm so glad! Thanks for the feedback, Hernan. Much appreciated.
@aaronmombos
@aaronmombos Жыл бұрын
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!
@vipeeera007
@vipeeera007 2 жыл бұрын
Great video. Could you please also start sharing the code to produce the graphs you use to visualize the concepts you speak about?
@michaelmillett1478
@michaelmillett1478 Жыл бұрын
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)
@michaelmillett1478
@michaelmillett1478 Жыл бұрын
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"))
@AnupKumar-nz2qq
@AnupKumar-nz2qq 2 жыл бұрын
Thank you for explaining in this beautiful manner
@RProgramming101
@RProgramming101 2 жыл бұрын
My pleasure 😊
@anggipermanaharianja6122
@anggipermanaharianja6122 2 жыл бұрын
One of the best t-test and p-values in YT!
@RProgramming101
@RProgramming101 2 жыл бұрын
Thank you for the feedback!
@jwenishkumawat3404
@jwenishkumawat3404 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!
@RProgramming101
@RProgramming101 2 жыл бұрын
Great to hear!
@huseyintoptay9666
@huseyintoptay9666 2 жыл бұрын
Great video. Thank you so much
@RProgramming101
@RProgramming101 2 жыл бұрын
You are so welcome! Glad you enjoyed it!
@DavidBarnwell876tkdja
@DavidBarnwell876tkdja 8 ай бұрын
Thanks for the video. Do you have one that discusses the density plots you created for life expectancy? This is an excellent series, btw.
@thulfiqaral-graiti7131
@thulfiqaral-graiti7131 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 жыл бұрын
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)
@ssaaurabh456
@ssaaurabh456 Жыл бұрын
you are simply awesome Greg i learn alot from You....Thanks to my GURU( means teacher in hindi)
@RProgramming101
@RProgramming101 Жыл бұрын
Wow, thanks! So nice of you.
@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?
@user-up7fp5tv6j
@user-up7fp5tv6j 4 ай бұрын
Thanks for such a great and clear explanation. Could you mind making a video on 'how to visualize the T-test result'?
@apelsinbzz
@apelsinbzz 2 жыл бұрын
work of a genius
@RProgramming101
@RProgramming101 2 жыл бұрын
Very kind of you to say.
@nandecomics
@nandecomics Жыл бұрын
Where do you get tidyverse, patchwork and gapminder? I'm using RStudio at the moment.
@jimmycliffordoppong7988
@jimmycliffordoppong7988 Жыл бұрын
Great video. But it will greatly be appreciated if you can share the codes for the graphs?
@Victoriataieb
@Victoriataieb Жыл бұрын
you are great teacher 🤩🤩
@RProgramming101
@RProgramming101 Жыл бұрын
Wow thank you. Cheers
@Duncanwg7
@Duncanwg7 2 жыл бұрын
Great video. A video on testing data for different distributions would be nice, such as normal, weibull etc.
@RProgramming101
@RProgramming101 2 жыл бұрын
Great suggestion!
@OFWCREATOR
@OFWCREATOR 2 жыл бұрын
Thank you sir!
@RProgramming101
@RProgramming101 2 жыл бұрын
You are welcome!
@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!
@VibeZ_1221
@VibeZ_1221 5 ай бұрын
Can you please share how to create those plots that u were showing during the start of the video
@MauroRenna
@MauroRenna 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 жыл бұрын
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.
@mykamillz
@mykamillz 2 жыл бұрын
Thanks for sharing
@RProgramming101
@RProgramming101 2 жыл бұрын
My pleasure
@davidispiryan5689
@davidispiryan5689 2 жыл бұрын
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 жыл бұрын
Great suggestion! Thank you for the feedback.
@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?
@theanita1
@theanita1 26 күн бұрын
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)
@ramoda13
@ramoda13 7 ай бұрын
nice video thank u
@RProgramming101
@RProgramming101 7 ай бұрын
Most welcome
@user-yt9ic2hg7f
@user-yt9ic2hg7f 5 ай бұрын
5:49 hypothesis test 10:51 test for difference of mean (two side test) 17:50 test for difference of mean (one side test)
@nabeelsiddiqui3377
@nabeelsiddiqui3377 2 жыл бұрын
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?
@RProgramming101
@RProgramming101 2 жыл бұрын
will do :)
@elispot17
@elispot17 2 жыл бұрын
Such a great video, can I have that R script?
@karikoga320
@karikoga320 Жыл бұрын
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 Жыл бұрын
Great suggestion! Thank you for the feedback.
@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 жыл бұрын
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)
@reem19681
@reem19681 2 жыл бұрын
very clear
@RProgramming101
@RProgramming101 2 жыл бұрын
Glad you think so!
@nat650091
@nat650091 10 ай бұрын
Why can't I install the packages after typing install.packages(patchwork) and install.packages(gapminder)? :(
@wiktoriajedryczka6979
@wiktoriajedryczka6979 2 ай бұрын
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 Ай бұрын
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 Ай бұрын
@@RProgramming101 Wonderful, thank you! All the best:)
@twiss9341
@twiss9341 2 жыл бұрын
Thank you
@RProgramming101
@RProgramming101 2 жыл бұрын
You're welcome!
@sushilojha5202
@sushilojha5202 2 жыл бұрын
please make vedios about principal component analysis in R
@RProgramming101
@RProgramming101 2 жыл бұрын
Thanks for the suggestion!
@Asuram23
@Asuram23 Жыл бұрын
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")
@paulbishop1641
@paulbishop1641 2 жыл бұрын
great videos thank you - would you be able to do something on how to work with skewed data
@RProgramming101
@RProgramming101 2 жыл бұрын
Great suggestion!
@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 Жыл бұрын
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
@sciencefliestothemoon2305
@sciencefliestothemoon2305 2 жыл бұрын
That might be a stupid question, but how to I create the vertical line for the mean in the graphs?
@RProgramming101
@RProgramming101 2 жыл бұрын
I'll make a video about that (hard to address in commments)
@sciencefliestothemoon2305
@sciencefliestothemoon2305 2 жыл бұрын
@@RProgramming101 thanks. 👍
@mugomuiruri2313
@mugomuiruri2313 2 жыл бұрын
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 жыл бұрын
@@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 Жыл бұрын
@@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
@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 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@souhaibsebbane5623 Thank you very much for your helpful answer! I'm going to try this out right away.
@SC-bi6my
@SC-bi6my 2 жыл бұрын
Hi, what statistics packages you are using? Can you share your R file?
@RProgramming101
@RProgramming101 2 жыл бұрын
Will find a way to get the script for you.
@ajayram3016
@ajayram3016 10 ай бұрын
May I know he source for DATA?
@petfield100
@petfield100 8 ай бұрын
One sided test for two different means: alway s the error: groupng factor must have two Steps?
@jamie10157
@jamie10157 Жыл бұрын
boom shakalaka - we did this!
@RProgramming101
@RProgramming101 Жыл бұрын
Amazing, Jamie! Thanks for your feedback.
@haraldurkarlsson1147
@haraldurkarlsson1147 2 жыл бұрын
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.
@medicalmarvels976
@medicalmarvels976 7 ай бұрын
Error: unexpected symbol in: "gapminde %>% filter(continent %in% c("Africa"." >
@boojaado
@boojaado 4 ай бұрын
This is the 'analyze' tutorial.
@matp3209
@matp3209 Жыл бұрын
7:32 the P value is not a probability, it’s just a number
@containerhobbyshop9735
@containerhobbyshop9735 2 жыл бұрын
Please pump up loudness next time.
@RProgramming101
@RProgramming101 2 жыл бұрын
Thanks for the suggestion!
@andresrengifo7801
@andresrengifo7801 2 жыл бұрын
Chacalaca
@RProgramming101
@RProgramming101 2 жыл бұрын
Boom...
@m.arijuanto9821
@m.arijuanto9821 2 жыл бұрын
I don't understand
ANOVA using R programming
15:36
R Programming 101
Рет қаралды 40 М.
t-Test - Full Course - Everything you need to know
16:14
DATAtab
Рет қаралды 253 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 68 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 20 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 29 МЛН
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 40 МЛН
Clean your data with R.   R programming for beginners.
27:31
R Programming 101
Рет қаралды 139 М.
t-tests and p values
8:58
Daniel M
Рет қаралды 63 М.
Learn R in 39 minutes
38:56
Equitable Equations
Рет қаралды 627 М.
Manipulate your data.   Data wrangling.   R programmning for beginners.
29:59
R Programming 101
Рет қаралды 74 М.
p-values: What they are and how to interpret them
11:21
StatQuest with Josh Starmer
Рет қаралды 1,1 МЛН
Chi Squared Test using R programming
16:59
R Programming 101
Рет қаралды 38 М.
How To Know Which Statistical Test To Use For Hypothesis Testing
19:54
Amour Learning
Рет қаралды 755 М.
🚨 YOU'RE VISUALIZING YOUR DATA WRONG. And Here's Why...
17:11
Adam Finer - Learn BI Online
Рет қаралды 33 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 68 МЛН