The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

R T Test Weightloss example E11.8

R T Test Weightloss example E11.8


Hi there,
I don’t understand the Solution for E11.8.

H0: muB-muA >=0      ok!
alternativ should be then
H1: muB-muA <0
The solution’s t.test Syntax is:
dep.t.test <- t.test(weight$before, weight$after, paired = TRUE, alternative = “g”)
shouldn’t it be:
dep.t.test <- t.test(weight$before, weight$after, paired = TRUE, alternative = “less”)
Thanks for the Help.

1 Answer

365 Team

Hi Alex, thanks for the question and apologies for the delay in response — unfortunately, this got lost in the threads somehow.
Not quite. But I do see now that the way I’ve stated the H0 might be a little confusing — I am editing the file now.
Anyhow, so…
The code in the solution is going off of this formulation of the hypotheses:
H0: muB – muA <= 0 OR D0 <= 0 (as defined here, the D is a negative number; or in the After condition people are either keeping their weight or increasing it)
H1: muB – muA > 0 OR D1 > 0 (as defined here, the D is a positive number)
So, in our code, we’d set the alternative argument in the code to “g” or the true difference in means is “more than zero“!
dep.t.test <- t.test(magn$Before, magn$After, paired=TRUE, alternative = "g")

Hopefully, this is helpful. 
Thank you for the question! 
Best wishes, 
365 Team

Hello Simona, I am confused with the Ho and trying to wrap my head around the solution. In my eyes, where: —> (Ub – Ua) = Do —> shouldn't "Do" be "> or =" to Zero? If we are trying to reject the Null, then why wouldn't Ho be something along the lines of: "The average weight of individuals in the before and after group did not decline (hence greater than or equal to) zero" and then if reject that going with H1 which would be Do < 0 stated along the lines of " At "x" % significance level, we can reject the Null and conclude participants in the weight-loss program experienced a statistically significant DECLINE in weight??

5 months
Complete Data Science Education
Get 50% OFF