





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Math 17, Section 2 Name _____ SOLUTIONS _____ Spring 2011
Goal: To gain experience with hypothesis tests for a mean, and to become familiar with using Rcmdr to run such hypothesis tests.
We’ll continue using our classroom data. For the purposes of this lab, we’re going to treat our class as a random sample of Amherst College students. You may or may not agree with this, but we’ll assume it is true. Let’s focus on the heights of Amherst College students.
We’ll consider the HEIGHT variable. According to the National Health Statistics Report number 10 (October 22, 2008), the average height of 20+ American males is 69.5 inches and the average height of 20+ American females is 64 inches.
Some summary statistics and graphs of the class data are given below.
Males Females
We’ll begin by testing whether the mean height of Amherst College males differs from the national average of 69.5 inches by hand.
To do that, compute the sample mean and standard deviation for HEIGHT by GENDER.
Go to: Statistics Summaries Numerical Summaries Select HEIGHT as the variable. Click the “Summarize by Groups” button and select GENDER as the grouping variable.
Q1] Give the sample size, sample mean, and standard deviation of HEIGHT for both genders.
The summary statistics are given below:
numSummary(ClassData[,"Height"], groups=ClassData$Gender,
Q2] Discuss whether the assumptions of the one-sample t -test are satisfied.
I think the assumptions are approximately satisfied:
Q3] State the hypotheses for testing whether the mean height of Amherst College males is more than that of the national average.
Let μ be the mean height of Amherst College males. We are testing
ᠴ⡨: † 㐄 69. ᠴ。: † 㐈 69.
Q4] Compute the test statistic value 䙸ᡲぁ⡹⡩ 㐄 げ
㍤⡹ゑㄖ う 㐕√ぁ
The test statistic is: ᡲぁ⡹⡩ 㐄
げ㍤⡹ゑㄖ う 㐕√ぁ
⡵⡨.⡶⡹⡴⡷.⡳ ⡩.⡷⡷ 㐕√⡩⡩
To run the test on men, we need to subset the data. Go to Data Active data set Subset active data set
You can include all variables, or uncheck that box and only include HEIGHT.
Enter Gender == “Male” into the subset expression box (note I’ve used two equals signs here)
Give the new dataset a name.
Now, go to Statistics Means (^) Single-sample t test
To compute a confidence interval, rerun the “Single-sample t test” only using “≠” in the alternative hypothesis.
Q8] Compare the Rcmdr results to those you got by hand.
The Rcmdr results match our results by hand.
Part 2 – A Two-Sample t -Test
We use a two-sample t -test to compare the means from two different groups. We’ll use it to compare the mean heights of male Amherst College students versus female Amherst College students.
Q9] Discuss whether the assumptions of the two-sample t -test are satisfied.
I think the assumptions are approximately satisfied:
Q10] State the hypotheses for testing whether the mean height of Amherst College males is more than that of Amherst College females.
Let μm be the mean height of Amherst College males and μf be the mean height of
Amherst College females. We are testing ᠴ⡨: † 㐄 †〳 ᠴ。: † 㐈 †〳
Q11] Compute the test statistic value. It is given here: ᡲ〱〳 㐄
げ㍤ㄗ⡹げ㍤ㄘ
㒖㊔ㄗ
ㄘ ㊉ㄗ⡸
㊔ㄘㄘ ㊉ㄘ
. The degrees of freedom
calculation is much more complicated now, though.
⡰
⡰ ㎗
⡰
⡰ ㎗
⡰ ᡦ⡩ ㎗
⡰ 11 ㎗
Part 3 – A Matched-Pairs t -Test
Some studies are interested in comparing the result of a treatment or study where two measurements are made on the same subject. Before/after studies are good examples of this. In such a situation, we do not have independent groups, so the usual two-sample t -test cannot be used.
A matched pairs t -test is used in this situation. The basic idea is that we take the difference between the two measurements, and focus on those. We can do a one-sample t -test on the differences.
Durability of shock absorbers. A manufacturer of automobile shock absorbers was interested
in comparing the durability of its shocks with that of the shocks produced by its biggest
competitor. To make the comparison, one of the manufacturer’s and one of the competitor’s
shocks were randomly selected and installed on the rear wheels of each of six cars. After the
cars had been driven 20,000 miles, the strength of each test shock was measured, coded, and
recorded. Results of the examination are shown in the table.
Car Number Manufacturer’s Shock Competitor’s Shock Difference 1 8.8 8.4 0. 2 10.5 10.1 0. 3 12.5 12.0 0. 4 9.7 9.3 0. 5 9.6 9.0 0. 6 13.2 13.0 0.
Enter these data into Rcmdr. Go to Data New data set
Give the data a name. A data editor will open and you can input the data. Doubleclicking the
“Var” at the top of the columns will bring up a window where you can each variable.
I named my dataset “Shocks” and gave the manufacturer data the name “OEM” and the
competitor data the name “Comp”. We can compute the difference and add it to our dataset by
going into the script window and typing:
Shocks$Difference <- Shocks$OEM - Shocks$Comp
You’ll have to replace “Shocks” with your dataset name, and “OEM” and “Comp” with your
variable names, too. Now, you’ve added column of differences to your dataset.
Q16] Explain why the data are collected as matched pairs.
The data are collected as matched pairs because both measurements are being
made on the same individual sample unit.
Q17] Do the data present sufficient evidence to conclude that there is a difference in the mean
By hand: Do a one-sample t -test using the differences
By Rcmdr: Go to Statistics Means Paired t test
numSummary(Schocks[,"Difference"], statistics=c("mean", "sd", "quantiles"),
The matched pairs test is really nothing more than taking the differences between
the two measurements and performing a one-samnple t-test on them.
Let μd be the mean difference between the OEM shocks and the competitors. We
are testing
ᠴ⡨: †〱 㐄 0 ᠴ。: †〱 㐅 0
The test statistic is: ᡲぁ⡹⡩ 㐄
げ㍤⡹ゑㄖ う 㐕√ぁ
⡨.⡲⡩⡵⡹⡨ ⡨.⡩⡱⡰⡷ 㐕√⡴
㐄 7.68. With 5 degrees of freedom, our
p-value is less than 0.005 (see the t-table). We reject the null hypothesis and
conclude that the shocks are different. Rcmdr gives similar results.
Paired t-test
data: Schocks$OEM and Schocks$Comp t = 7.6787, df = 5, p-value = 0. alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.2771799 0. sample estimates: mean of the differences