Hypothesis Testing using R - TwoTailTest


Two - Tail test
Consider the following treadmill usage data:
Product Age Gender Education Marital Status Usage Fitness Income Miles
TM195 18 Male 14 Single 3 4 29562 112
TM195 19 Male 15 Single 2 3 31836 75
TM195 19 Female 14 Partnered 4 3 30699 66
TM195 19 Male 12 Single 3 3 32973 85
TM195 20 Male 13 Partnered 4 2 35247 47
TM195 20 Female 14 Partnered 3 3 32973 66
TM195 21 Female 14 Partnered 3 3 35247 75
TM195 21 Male 13 Single 3 3 32973 85
TM195 21 Male 15 Single 5 4 35247 141
TM195 21 Female 15 Partnered 2 3 37521 85
TM498 19 Male 14 Single 3 3 31836 64
TM498 20 Male 14 Single 2 3 32973 53
TM498 20 Female 14 Partnered 3 3 34110 106
TM498 20 Male 14 Single 3 3 38658 95
TM498 21 Female 14 Partnered 5 4 34110 212
TM498 21 Male 16 Partnered 2 2 34110 42
TM498 21 Male 12 Partnered 2 2 32973 53
TM498 23 Male 14 Partnered 3 3 36384 95
TM498 23 Male 14 Partnered 3 3 38658 85
TM498 23 Female 16 Single 3 3 45480 95

Analyze the Miles clocked by Gender

SOLUTION:
#Variance for two samples is assumed to be different apart from normal distribution
t.test(Miles~Gender)

#Variance for two samples is assumed to be same apart from normal distribution
t.test(Miles~Gender, var.equal = TRUE)



CONCLUSION

  • Pvalue > Alpha and hence NULL hypothesis is not rejected
  • 95% confidence interval is difference between miles clocked by the Males vs Females
  • 95% of the time Females clock more Miles than Males either on the lower side by -26.83 or on the higher side by 69.49

REFERENCES

Comments