Introduction to Statistics (MAT/SST 115.03 2008S)

R notes for Activity 22-1: Close Friends

22-1 i. Computing the test statistic

You can use R to compute the test statistic. Recall that this test statistic has the form

(x1bar - x2bar)/sqrt(s1*s1/n1 + s2*s2/n2)

You can fill in the values.

22-1 o. Computing a confidence interval

Okay, you need to compute

(xfbar-xfbar) +/- tkstar*sqrt(sf*sf/nf + sm*sm/nm)

I'll leave you to fill in the details.

22-1 p. Computing the p-value

As the book suggests, you can use the applet. You can also use R's pt function to compute the p-value. Since it's a two-sided test, we should double the computed value.

t = (1.861-2.089)/sqrt(1.777*1.777/654 + 1.760*1.760/813)
2*pt(t, df=653)

Creative Commons License

Samuel A. Rebelsky,

Copyright (c) 2007-8 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.