Тёмный

t-test and interpreting p values using R Programming 

R Programming 101
Подписаться 106 тыс.
Просмотров 86 тыс.
50% 1

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.

Опубликовано:

 

7 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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!
@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!
@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!
@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!
@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!
@michaelmillett1478
@michaelmillett1478 Год назад
I really appreciate you making these videos! They are really helpful!
@RProgramming101
@RProgramming101 Год назад
Glad you like them! You are so welcome!
@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
@jd5481
@jd5481 2 года назад
Another great one in the bag. Great job!
@RProgramming101
@RProgramming101 2 года назад
Thanks 👍🏻
@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"))
@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!
@LearningAddict
@LearningAddict 2 года назад
I really enjoyed your videos. As always. Thx for making this great video explanation.
@RProgramming101
@RProgramming101 2 года назад
Glad you enjoyed it!
@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
@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 😁
@etm9703
@etm9703 Год назад
Great video! Helped me with my R lab homework, thank you!!
@RProgramming101
@RProgramming101 Год назад
You're very welcome! Glad it was helpful!
@AnupKumar-nz2qq
@AnupKumar-nz2qq 2 года назад
Thank you for explaining in this beautiful manner
@RProgramming101
@RProgramming101 2 года назад
My pleasure 😊
@hernanrosas2995
@hernanrosas2995 2 года назад
Learning so much from your videos!
@RProgramming101
@RProgramming101 2 года назад
I'm so glad! Thanks for the feedback, Hernan. Much appreciated.
@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! ☺
@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!
@huseyintoptay9666
@huseyintoptay9666 2 года назад
Great video. Thank you so much
@RProgramming101
@RProgramming101 2 года назад
You are so welcome! Glad you enjoyed it!
@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'?
@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.
@AmitYadav-ee7sz
@AmitYadav-ee7sz Год назад
I hope you will never stop making videos on R........as far as R is in trend.
@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.
@OFWCREATOR
@OFWCREATOR 2 года назад
Thank you sir!
@RProgramming101
@RProgramming101 2 года назад
You are welcome!
@apelsinbzz
@apelsinbzz 2 года назад
work of a genius
@RProgramming101
@RProgramming101 2 года назад
Very kind of you to say.
@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)
@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!
@Victoriataieb
@Victoriataieb Год назад
you are great teacher 🤩🤩
@RProgramming101
@RProgramming101 Год назад
Wow thank you. Cheers
@jimmycliffordoppong7988
@jimmycliffordoppong7988 Год назад
Great video. But it will greatly be appreciated if you can share the codes for the graphs?
@mykamillz
@mykamillz 2 года назад
Thanks for sharing
@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!
@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.
@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!
@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.
@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!
@sushilojha5202
@sushilojha5202 2 года назад
please make vedios about principal component analysis in R
@RProgramming101
@RProgramming101 2 года назад
Thanks for the suggestion!
@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!
@elispot17
@elispot17 2 года назад
Such a great video, can I have that R script?
@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)
@ramoda13
@ramoda13 7 месяцев назад
nice video thank u
@RProgramming101
@RProgramming101 7 месяцев назад
Most welcome
@VibeZ_1221
@VibeZ_1221 5 месяцев назад
Can you please share how to create those plots that u were showing during the start of the video
@theanita1
@theanita1 28 дней назад
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)
@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 :)
@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?
@nandecomics
@nandecomics Год назад
Where do you get tidyverse, patchwork and gapminder? I'm using RStudio at the moment.
@reem19681
@reem19681 2 года назад
very clear
@RProgramming101
@RProgramming101 2 года назад
Glad you think so!
@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.
@shokhrukhusmanov1049
@shokhrukhusmanov1049 Год назад
Can you explain how you did create plots for t.test?
@twiss9341
@twiss9341 2 года назад
Thank you
@RProgramming101
@RProgramming101 2 года назад
You're welcome!
@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
@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)
@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:)
@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.
@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")
@nat650091
@nat650091 10 месяцев назад
Why can't I install the packages after typing install.packages(patchwork) and install.packages(gapminder)? :(
@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. 👍
@petfield100
@petfield100 8 месяцев назад
One sided test for two different means: alway s the error: groupng factor must have two Steps?
@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.
@medicalmarvels976
@medicalmarvels976 7 месяцев назад
Error: unexpected symbol in: "gapminde %>% filter(continent %in% c("Africa"." >
@ajayram3016
@ajayram3016 10 месяцев назад
May I know he source for DATA?
@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.
@containerhobbyshop9735
@containerhobbyshop9735 2 года назад
Please pump up loudness next time.
@RProgramming101
@RProgramming101 2 года назад
Thanks for the suggestion!
@matp3209
@matp3209 Год назад
7:32 the P value is not a probability, it’s just a number
@boojaado
@boojaado 5 месяцев назад
This is the 'analyze' tutorial.
@andresrengifo7801
@andresrengifo7801 2 года назад
Chacalaca
@RProgramming101
@RProgramming101 2 года назад
Boom...
@m.arijuanto9821
@m.arijuanto9821 2 года назад
I don't understand
Далее
Clean your data with R.   R programming for beginners.
27:31
T-test, ANOVA and Chi Squared test made easy.
15:07
Просмотров 284 тыс.
Mansan oshdi😅
00:22
Просмотров 487 тыс.
ANOVA using R programming
15:36
Просмотров 40 тыс.
t-Test - Full Course - Everything you need to know
16:14
Learn R in 39 minutes
38:56
Просмотров 629 тыс.
p-values: What they are and how to interpret them
11:21
P-Value Method For Hypothesis Testing
17:48
Просмотров 1,5 млн
Chi Squared Test using R programming
16:59
Просмотров 38 тыс.
Loops using R programming
13:37
Просмотров 12 тыс.