👋🏼 Hello there! In this video we discuss how to conduct the one-sample t-test and calculate the confidence interval with R (with example).📝 Correction (0:01:10): the alternative hypothesis in this video should be mu less than 8; Ho: mu=8 (or more specifically, mu equal or greater than 8) and Ha: mu less than 8 (Thanks to @ShairozSohail for catching this)! Find the free R practice dataset (LungCapData) here: ( www.statslectures.com/r-scripts-datasets ); Like to support us? You can Donate (bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us Thumbs up! Either way We Thank You!
this was so helpful i have a midterm for this tomorrow and you were the only straight-forward resource on the internet that explained how to change the confidence interval in t-tests
I started my PhD two months ago. I didn't "play" with statistics for nearly 12 years. Totally lost, I am (still) finding my way through your videos. Thank you so much for sharing the knowledge!
Bro I tought i finally understood which value belongs to alternative then I wanted it confirmed, watched this video and tought I‘m dumb as hell. Thanks for your 8 year old comment mate
HI Marin thanks for all these videos these are very helpful, i would like to do a thorough practice for R. I would like to know if you could put and recommendation material for R and any book? Thanks
Hi, this is probably a silly question, but what exactly is "mu". I know it is a null hypothesis, but a how is it significant? Do I need a value of "mu" to make my t-test mean something? Cause "R" will perform the test either way. For one sample I got a t-test value of "0.2" and for the other "0.6". Something tells me that "0.2" one is more accurate but i am not sure. Sorry, I am new to this type of data/error analysis but I want to learn it as I study physics (second year). Thanks!
Thank you for the videos, they are great. Can you help me how to do t-test in R if sample mean and sample variance is known but not the individual samples itself. In you example, sample mean and variance are calculated from the values in the table. However, I am required to do a test when data is not known, only the mean & variance.
Hi Mike, what i learnt for one sample t test, as null hypothesis we always took mu =110( 110 as a example) and alternative is mu> 110.... 1... My question is , is R always consider the Ho and H1 as you took?? 2... I tried to solve the question which i did in my school with R..But the answers are totally different?? Data( 156, 123, 92,56,73,101,101,174,100,125,64,165,110,83,109,182) , mu=110, Conf=5% 3...Do we use t distribution for small sample size??? like n
Hi +nali chandi , in R you specify the null value using the *mu* argument (in the video, i use mu=8). the alternative is specified using the *alt* argument, set to greater/less/two.sided. you should always use the t-distribution (you can use Z/normal with really large sample sizes, but as a general rule, the only time you can really use the Z instead of t is when you KNOW the true standard deviation...which is NEVER the case in reality. heres how to do the t.test you want, in R, using an alternative hypothesis of greater than 110, and a null of Ho:mean=110 *x
What packages do I need to have downloaded to do this? I just downloaded R, and tried and even the box plot step couldn't get done. I assume I need a suite of packages. Frustrating when I can even get past the first step.
I want to test between competitions of bacteria but It would mean doing a t-test on every single row. How do I do something called a block, so it I don't have to go through as test every bit of data?
Hi Jenna Proctor , the word "block" has many different meanings and uses in statistics, so I'm not sure exactly how you are using the word here. in general, you can use the *apply* function in R to apply a function over rows or columns of a data frame. as an example, you can use *apply(data, 1, t.test)* to apply the t.test to the rows (using 1=rows, 2=columns) of data. this will return messy results though, as it will return all the results. what id suggest is to store them in some object, say *results
This helps a lot!! I will try it out and see if it works. Thank you so much!!!! I didn't give a great explanation but I think it may solve the problem :)
>Error in apply(data, 1, t.test) : dim(X) must have a positive length I got this in the output box of my R script. have I written it wrong? I have three columns with three main treatments SM:SM WS:WS WS:SM I want to do a test on the third column but in each treatment too.
Hi Jenna Proctor , things are a bit unclear. in your previous comment you said you want to do a t-test on each row of your data, and this will do that. but now you are saying that you want to do a t-test on the 3rd column of your data, so I'm not really sure what you want to do. in general, the *apply* function can be used to apply a function across rows or columns of a data frame in R.
Hi, we have a video showing how to find probabilities for the normal distribution (which is essentially the same thing as the Z test): ruclips.net/video/zUnC1CV4FAc/видео.html we dont spefically show Z test, as it is a special (and unrealistic case), and you would generally have to use t, not Z, in any real world application....but you can check out that video for how to find probabilities for Z scores
Hi mm. It's me aga. One of your fan. I'm trying to replicate your action TEST$confi.int gives a NULL value I realise the language is so sensitive as in the case of TEST$conf.int gives the said value. Are there any way to make R recognize that they're in fact similar commands? cause often at times I either misspelt or had a Upper case error.
Keng King no, R is case sensitive (meaning upper/lower case are different). the object Test and test, and TEST will all be recognized as different objects in R. you have to be very careful with typing, as mis-spelling, changing upper to lower case, etc, will change the meaning for R.
not sure what you're asking... here's some info that may be helpful... the Z-test is mostly just a teaching tool, and rarely/never applicable in a real world. the Z test is for when you KNOW the population standard deviation (sigma), and this is almost never realistic. it is quite rare that you would be trying to estimate the mean of a population, but know the SD of the population.
Hi, maybe you can elaborate...not sure what you mean here. to analyze data, you need to have some data. this is a dataset that is saved in a spreadsheet and imported into R. not sure exactly what it is you are looking for...i may be able to offer some help if you can clarify what it is you are actually looking to do.
oh, i see what you meant to say. that wouldn't really make any sense here. the dataset we work with has 725 rows and 6 columns, so that would require entering 4,350 observations by hand...also, things are never done this way. data is generally imported into R and then worked on...it is pretty much never entered manually into R. In our videos, we try to show real world programming skills. we do have a separate video showing how to create a matrix in R, which may be of help if you are looking for that.
I have also seen your video on vectors.So think from a student perspective .What if you were to create a data matrix like air passenger that is available on R studio from scratch ?
👋🏼 Hello there! In this video we discuss how to conduct the one-sample t-test and calculate the confidence interval with R (with example).📝 Correction (0:01:10): the alternative hypothesis in this video should be mu less than 8; Ho: mu=8 (or more specifically, mu equal or greater than 8) and Ha: mu less than 8 (Thanks to @ShairozSohail for catching this)! Find the free R practice dataset (LungCapData) here: ( www.statslectures.com/r-scripts-datasets ); Like to support us? You can Donate (bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us Thumbs up! Either way We Thank You!
this was so helpful i have a midterm for this tomorrow and you were the only straight-forward resource on the internet that explained how to change the confidence interval in t-tests
great to hear! hope the exam went well ;)
I started my PhD two months ago. I didn't "play" with statistics for nearly 12 years. Totally lost, I am (still) finding my way through your videos. Thank you so much for sharing the knowledge!
you're welcome, glad you're finding them helpful :)
I will recommend your tutorials to all people that wanna begin their adventure with R :)
great to hear +dupa blada
you are amazing MR marin
Good work Marin. Best wishes
Mike, thanks for making these videos. They are so helpful to a novice like myself!
you're welcome +lB061988 ! we're glad you're finding them helpful!
why are these videos so good? thank you so much!
thanks +soha shadbash , we appreciate that!
in the example, the alternative hypothesis is (mu>8), If I am not mistaken then the code has to be corrected as alt="greater" instead of "less
"
Thankyou so much👐👐👐
Thank you sir!
you're welcome
If you specified Ho as mu
Thanks for catching that Shairoz Sohail , that should be that the alternative is mu=8) and Ha: mu
I think thoes thumbs down are because of this mistake.
@@marinstatlectures : I just watched your video, I was about to ask the same question.
Bro I tought i finally understood which value belongs to alternative then I wanted it confirmed, watched this video and tought I‘m dumb as hell. Thanks for your 8 year old comment mate
Thank you very much for the good content.
HI Marin thanks for all these videos these are very helpful, i would like to do a thorough practice for R. I would like to know if you could put and recommendation material for R and any book?
Thanks
how do you know you know to define mu as less than 8? do you just make it up? Like, How did you know to use that specific number
Hello ! Can I use the same command for hypothesis test : mean 20???
can we calculate varience from p value and xi2 and no of dof ?
Your videos are so helpful. Thank you.How would you perform a test where you test if the variance of one sample is greater than a specified number?
Hi, this is probably a silly question, but what exactly is "mu". I know it is a null hypothesis, but a how is it significant? Do I need a value of "mu" to make my t-test mean something? Cause "R" will perform the test either way.
For one sample I got a t-test value of "0.2" and for the other "0.6". Something tells me that "0.2" one is more accurate but i am not sure.
Sorry, I am new to this type of data/error analysis but I want to learn it as I study physics (second year).
Thanks!
Thank you for the videos, they are great.
Can you help me how to do t-test in R if sample mean and sample variance is known but not the individual samples itself.
In you example, sample mean and variance are calculated from the values in the table. However, I am required to do a test when data is not known, only the mean & variance.
May I know if R can also perform SQL by itself?
Keng King you will need to use a package, *sqldf* seems to be the most popular. although this is not an area of mine, so i'm not able to comment much.
Hi Mike, what i learnt for one sample t test, as null hypothesis we always took mu =110( 110 as a example) and alternative is mu> 110....
1... My question is , is R always consider the Ho and H1 as you took??
2... I tried to solve the question which i did in my school with R..But the answers are totally different??
Data( 156, 123, 92,56,73,101,101,174,100,125,64,165,110,83,109,182) , mu=110, Conf=5%
3...Do we use t distribution for small sample size??? like n
the result of question no 2 by the hand calculation is t=0.34, p-value=1.753 df=15 and we accept H0
Hi +nali chandi , in R you specify the null value using the *mu* argument (in the video, i use mu=8). the alternative is specified using the *alt* argument, set to greater/less/two.sided. you should always use the t-distribution (you can use Z/normal with really large sample sizes, but as a general rule, the only time you can really use the Z instead of t is when you KNOW the true standard deviation...which is NEVER the case in reality. heres how to do the t.test you want, in R, using an alternative hypothesis of greater than 110, and a null of Ho:mean=110
*x
Thanks a lot Mike!!
What packages do I need to have downloaded to do this? I just downloaded R, and tried and even the box plot step couldn't get done. I assume I need a suite of packages. Frustrating when I can even get past the first step.
I want to test between competitions of bacteria but It would mean doing a t-test on every single row. How do I do something called a block, so it I don't have to go through as test every bit of data?
Hi Jenna Proctor , the word "block" has many different meanings and uses in statistics, so I'm not sure exactly how you are using the word here. in general, you can use the *apply* function in R to apply a function over rows or columns of a data frame. as an example, you can use *apply(data, 1, t.test)* to apply the t.test to the rows (using 1=rows, 2=columns) of data. this will return messy results though, as it will return all the results. what id suggest is to store them in some object, say *results
This helps a lot!! I will try it out and see if it works. Thank you so much!!!! I didn't give a great explanation but I think it may solve the problem :)
you're welcome, good luck with your work
>Error in apply(data, 1, t.test) : dim(X) must have a positive length
I got this in the output box of my R script. have I written it wrong? I have three columns with three main treatments SM:SM WS:WS WS:SM I want to do a test on the third column but in each treatment too.
Hi Jenna Proctor , things are a bit unclear. in your previous comment you said you want to do a t-test on each row of your data, and this will do that. but now you are saying that you want to do a t-test on the 3rd column of your data, so I'm not really sure what you want to do. in general, the *apply* function can be used to apply a function across rows or columns of a data frame in R.
Do you also have One-Sample Z Test in R radio available? Thank you!
Hi, we have a video showing how to find probabilities for the normal distribution (which is essentially the same thing as the Z test): ruclips.net/video/zUnC1CV4FAc/видео.html
we dont spefically show Z test, as it is a special (and unrealistic case), and you would generally have to use t, not Z, in any real world application....but you can check out that video for how to find probabilities for Z scores
Hi, how can I actually change my level of significance using R ?
how many from cps analytics?
I can't understand why u used mu =8??
Hi mm. It's me aga. One of your fan. I'm trying to replicate your action TEST$confi.int gives a NULL value
I realise the language is so sensitive as in the case of TEST$conf.int gives the said value. Are there any way to make R recognize that they're in fact similar commands? cause often at times I either misspelt or had a Upper case error.
Keng King no, R is case sensitive (meaning upper/lower case are different). the object Test and test, and TEST will all be recognized as different objects in R. you have to be very careful with typing, as mis-spelling, changing upper to lower case, etc, will change the meaning for R.
Hello , how are you? I want to contact with you for important lesson , thanks.
Z test ?????
not sure what you're asking... here's some info that may be helpful... the Z-test is mostly just a teaching tool, and rarely/never applicable in a real world. the Z test is for when you KNOW the population standard deviation (sigma), and this is almost never realistic. it is quite rare that you would be trying to estimate the mean of a population, but know the SD of the population.
its really of no help if you use already built data sets
Hi, maybe you can elaborate...not sure what you mean here. to analyze data, you need to have some data. this is a dataset that is saved in a spreadsheet and imported into R. not sure exactly what it is you are looking for...i may be able to offer some help if you can clarify what it is you are actually looking to do.
Start with building a matrix from scratch like Matrix A=c(45,56,67,89)
Then analyze it.
oh, i see what you meant to say. that wouldn't really make any sense here. the dataset we work with has 725 rows and 6 columns, so that would require entering 4,350 observations by hand...also, things are never done this way. data is generally imported into R and then worked on...it is pretty much never entered manually into R. In our videos, we try to show real world programming skills.
we do have a separate video showing how to create a matrix in R, which may be of help if you are looking for that.
How do you create data set and merge them into rows and columns for t testing from scratch ?
I have also seen your video on vectors.So think from a student perspective .What if you were to create a data matrix like air passenger that is available on R studio from scratch ?