15. Different ways to perform t test in STATA (Two Independent Samples and One Sample)

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • Stata Playlist: • Learn STATA with us (B...
    hello guys my name is khan and in today's video I will discuss that how we can do t testing uh instead so there are different ways through which we can do a t-test in stata so I will go one by
    so one of the ways is that suppose we already know the parameters of samples all we already know there are two samples that we have and you know the observations of one sample what is the mean of the first sample and what is the standard deviation of the first sample and we also know about the number of observations what's the mean and the standard deviation of the second sample so suppose so, in that case, suppose the observations are 50 for the first sample and the mean is 30 for the first sample and the standard deviation is 10 for the first sample in the same way where we have 60 observation from the second sample and then we have mean of 30 five of the second sample and standard deviation of 30 and we want to do t testing before that that these two samples have a similar mean or not all can have the same mean or not so suppose if I execute this command
    let's see here so here you can see this is the output result of our t test and this is telling us that our hypothesis is that the difference between these two sample by defaults that have four ones for sample x in the second sample y and then it's saying that the hypothesis that the difference between two samples is zero and the alternative we have three alternative hypotheses we can get the result from one is the left tail racing difference is less than zero and the other is not equal to zero and the third alternative hypothesis is that difference is greater than zero and we also have the p values so what a p value is that what's the probability that the hypothesis is true or not so actually this is the null hypothesis so this is the probability that there is a 0.028 probability that these uh two samples have the same mean or the difference is zero so at the five percent level of significance we will reject this null hypothesis which is saying that the difference is zero now if we go back there are many other ways through which you can do uh t testing suppose if you have some sort of data so i'm using or system is data data which is comes with you can apply to any other data that you have
    so there is a variable which is the price which is capturing prices of different cars and then I have a variable foreign which is capturing that the car is domestic and before so in this data set the own this variable foreign I have only two categories and that's why I can apply uh suppose if I want to see that the prices of the foreign cars are different from the domestic car so I can do a t-test but make sure the variables based on which you are trying to do t-tests have only two categories if the foreign variable has three or four categories you will probably get an error so if I go back to my file so this is the code for that I do the s price by 4
    and then it will show me you can see that it is grouping by domestic and foreign and saying that the difference between two samples is this and then we have another hypothesis which is the difference between mean domestic and mean foreign is equal to zero and then we have the probabilities the p values related to that d test and the t value is given here on the right-hand side of this table so, in the same way, we can do another way so suppose currently I have applied t-test on one variable price and then set that categorize they will try to come there are two further categories within this foreign variable and try to compare those two categories but suppose if you want to compare two variables suppose if you want to see that it will be able that I have the data source here
    so so I suppose if I want to compare to variables like VDL and i want to see that these two-sample or observations have a similar mean or not so in that case what I will do i will just come here and i will just say t-test weight is equal to that
    and case you can see i have been able to do a t-test on two separate variables to see how those two variables are similar to each other but they have a similar mean or not and the one last thing I would like to tell you is you also can do one sample t-test in which you can use only one variable and say and try to suppose come up with a hypothesis that maybe this weight variable is equal to some values you will take cover and in that case, you will write down this command probability so you can change the variable name and now you can see that I am doing a one-sample t-test.
    STATA PLAYLIST: • Learn STATA with us (B...
    In this video, I discussed different ways of performing t-test in STATA.
    For more videos related to STATA kindly see the given below playlist.
    • Learn STATA with us (B...
    Thanks
    #how #perform #t-test #stata

КОМЕНТАРІ • 6