0

can someone help me hypothesis testing in R?

I have 2 lists: set.seed(120) TeamA=rnorm(30,100,15) TeamB=rnorm(30,100,15) I want to prove that mean of TeamA is greater than TeamB. Q1-What should be my Null & Alternate Hypothesis? Q2- How can I prove it via t-test?

12th Apr 2020, 4:28 PM
M Singh
4 Answers
+ 1
H0 would be: mean of Team A is greater than mean of Team B (mu(A) > mu(B)) H1 is the logical opposite to H0: mean of A does not equal mean of B (mu(A) <= mu(B)) The function you are looking for is t.test(). Two-sided is default, also mind the var.equal parameter and order of data input (x, y parameters). You may want to check the docs yourself, use ?t.test :)
13th Apr 2020, 4:51 PM
Lisa
Lisa - avatar
+ 1
Looks fine to me, except for I would specify var.equal = TRUE in order to do a standard t-test (in your example you sample both data vectors from the same normal distribution) mu is the difference in means, you only need to specify it, if you are interested in sth else than the default 0 When you test mu(A) = mu(B) , you could write as well mu(A) - mu(B) = 0 --> and that's the mu-param in the function! alternative is critical for the hypothesis you want to test: x = y (two.sided), x > y (x greater y), x < y (x less y) so if you are doing one sided testing, take care of what you select as x and y
14th Apr 2020, 11:24 AM
Lisa
Lisa - avatar
0
* correction to H1 It should be: "mean of A is smaller than or equal to mean of B" Sorry!
13th Apr 2020, 5:52 PM
Lisa
Lisa - avatar
0
Thanks Lisa for answering my question! Can you confirm that all inputs are correct here for t test: t.test(BranchA,BranchB, alternative = "greater",mu=0) Actually I want to understand what alternative - greater means and why we take mu=0 here?
14th Apr 2020, 10:46 AM
M Singh