AMS572.01 Practice Midterm Exam Fall, 2010

AMS572.01
Fall, 2010 ♠♣♥♦
Practice Midterm Exam
Name: ________________________________ ID: _____________________ Signature: _________________________
Instruction: This is a close book exam. Anyone who cheats in the exam shall receive a grade of F. Please provide
complete solutions for full credit. The exam goes from 12:50-2:10pm. Good luck! (*The real midterm will be given on
Monday, 10/25/2010, in class.)
1 (for all students in class). In a study of hypnotic suggestion, 10 male volunteers were randomly allocated to an
experimental group and a control group. Each subject participated in a two-phase experimental session. In the
first phase, respiration was measured while the subject was awake and at rest. In the second phase, the subject
was told to imagine that he was performing muscular work, and respiration was measured again. For subjects in
the experimental group, hypnosis was induced between the first and second phases; thus, the suggestion to
imagine muscular work was “hypnotic suggestion” for experimental subjects and “waking suggestion” for
control subjects. The accompanying table shows the measurements of total ventilation (liters of air per minute
per square meter of body area) for all 10 subjects.
Subject
1
2
3
4
5
Experimental Group
Rest
Work
6
6
7
9
5
8
7
12
6
7
Subject
6
7
8
9
10
Control Group
Rest
6
5
5
6
5
Work
5
5
5
6
4
(a) Use suitable tests to investigate (Use α =.05 for each test. Please report the p-value for each test and state the
assumption(s) of the test.)
(i)
the response of the experimental group to suggestion;
(ii)
the response of the control group to suggestion;
(iii)
the differences between the responses of the experimental and control groups.
(b) Please write up the entire SAS program necessary to answer questions raised in (a). Please include the data
step as well as tests for testing for various assumptions.
Answer:
(a) Response = Work - Rest
(i) Inference on one population mean. Small sample.
x1  2.2, s1  1.9, n1  5
H 0 : 1  0 vs H a : 1  0
t0 
x1  0
2.2  0

 2.56
s1 / n1 1.9 / 5
Since t0  2.56  t4,0.05  2.132 we reject H0 at the significance level   0.05.
Since t 4,0.025  2.776  t0  2.56  t4,0.05  2.132 we can infer that 0.025  p  value  0.05 . The assumption
is that the response from the experimental group is normally distributed.
Note: if the normality assumption is not true, we will perform the nonparametric test – either the sign test or the
signed-rank test.
(ii) Inference on one population mean. Small sample.
x 2  0.4, s2  0.55, n2  5
H 0 : 2  0 vs H a :  2  0
t0 
x2  0
 0.4  0

 1.63
s2 / n2 0.55 / 5
Since t0  1.63  t4,0.05  2.132 we can not reject H0 at the significance level   0.05.
Since t4,0.05  2.132  1.63  t4,0.1  1.533 we can infer that 0.9  1  0.1  p  value  1  0.05  0.95 . The
assumption is that the response from the control group is normally distributed.
Note: if the normality assumption is not true, we will perform the nonparametric test – either the sign test or the
Wilcoxon signed-rank test.
(iii) Inference on two population means. Two small, independent samples.
Sample 1: responses from the experimental group.
Sample 2: responses from the control group.
X1  2.2, X 2  0.4, n1  n2  5, s1  1.9, s2  0.55
Under the normality assumption, we first test if the two population variances are equal H 0 :  12   22 vs
H a :  12   22 .
Test statistic
s2
F0  12  12.33 , F4,4,0.025  9.60 and F4,4,.0975  1/ F4,4,.025  1/ 9.6  0.104 .
s2
Since F0 is larger than 9.60, we reject H0 . Therefore it is not reasonable to assume that  12   22 .
If both populations are normal, we can test the equality of the two populations means using the unequalvariance t-test. If at least one population is not normal, we will perform the nonparametric test – Wilcoxon rank
sum test (also referred to as the Mann-Whitney U test).
Here assuming both populations are normal, we will perform the un-equal variance t-test to check whether the
responses from the two groups are different or not. We will use the simple (and less accurate) formula for
calculating the degrees of freedom calculation: d.f. = min( n1  1, n2  1 )
H 0 : 1  2  0 , H a : 1  2  0
T.S : T0 
( X1  X 2 )  0
s12 s22

n1 n2
H0
~ t4
At α=0.05, reject H 0 in favor of H a iff T0  t4,0.025  2.776
Here t0 
( X1  X 2 )  0
2
1
2
2
s
s

n1 n2

2.2  (0.4)
1.92 0.552

5
5
 2.939
Since 2.939 > 2.776, we conclude that the responses from the two groups are different at the significance level of 0.05.
(b)
/*Problem #1*/
data one;
input ID group rest work;
diff=work-rest;
datalines;
1 1 6 6
2 1 7 9
3 1 5 8
4 1 7 12
5 1 6 7
6 2 6 5
7 2 5 5
8 2 5 5
9 2 6 6
10 2 5 4
;
run;
proc univariate data=one normal;
class group;
var diff;
title 'Check for normality and test for one population mean, Q1';
run;
proc ttest data=one;
class group;
var diff;
title 'Independent samples t-test, Q1';
run;
proc npar1way data=one wilcoxon;
class group;
var diff;
title 'Nonparametric test for two-mean comparisons, Q1';
run;
2A (for AMS students). Suppose we have two independent random samples from two normal populations:
X1, X 2 ,
, X n1 ~ N  1 ,  2  , and Y1 , Y2 ,
, Yn2 ~ N  2 ,  2  . At the significance level α, please construct a test to test
whether 1  22 or not. (*Please include the derivation of the pivotal quantity, the proof of its distribution, and the
derivation of the rejection region for full credit.)
SOLUTION: Here is a simple outline of the derivation of the test: H 0 : 1  2 2  0 versus H a : 1  2 2  0


(a) We start with the point estimator for the parameter of interest 1  2 2  : X  2Y . Its distribution is





X  2Y   
Z

N 1  2 2 ,  2 1 / n1  4 / n2  using the mgf for N  ,  2 which is M t   exp t   2 t 2 / 2 , and the
independence properties of the random samples. From this we have
1
 2 2 
 1 / n1  4 / n2
~ N 0,1 .
Unfortunately, Z can not serve as the pivotal quantity because σ is unknown.
(b) We next look for a way to get rid of the unknown σ following a similar approach in the construction of the
pooled-variance t-statistic. We found that W  n1  1S12  n2  1S 22 /  2 ~  n21 n2 2 using the mgf for  k2

1
which is M t    
 2t 

k/2
, and the independence properties of the random samples.
(c) Then we found, from the theorem of sampling from the normal population, and the independence properties of the
random samples, that Z and W are independent, and therefore, by the definition of the t-distribution, we have
X  2Y   
obtained our pivotal quantity: T 
1
 2 2 
S p 1 / n1  4 / n2
pooled sample variance.
~ t n1  n2 2 , where S 
2
p
n1  1S12  n2  1S 22
n1  n2  2
is the


(d) The rejection region is derived from P T0  c | H 0   , where T0 
X  2Y   0
S p 1 / n1  4 / n2
H0
~ t n1  n2 2 . Thus
c  t n1  n2  2, / 2 . Therefore at the significance level of α, we reject H 0 in favor of H a iff T0  t n1 n2 2, / 2
2B (for all non-AMS students). In order to test the accuracy of speedometers purchased from a subcontractor, the
purchasing department of an automaker orders a test of a sample of speedometers at a controlled speed of 55 mph. At
this speed, it is estimated that the variance of the readings is 1.
(a). How many speedometers need to be tested to have a 95% power to detect a bias of 0.5 mph or greater using a 0.01
level test?
(b). A sample of the size determined in (a) has a mean of 55.2 and standard deviation of 0.8. Can you conclude that the
speedometers have a bias?
(c). Calculate the power of the test if 50 speedometers are tested and the actual bias is 0.5 mph. Assume a population
standard deviation of 0.8.
SOLUTION:
 H 0 :   0  55
 H a :   a  55.5  55
(a) 
power  0.95    0.05.   1,   0.01 .
n
( z  z ) 2  2
(  a  0 ) 2

(2.326  1.645) 212
(2.326  1.645)2 0.82

63.1

64
(*Note,
if
,
n

 40.4  41 )


0.8
(55.5  55) 2
(55.5  55)2
Hence, 64 packages of cereal speedometers need to be tested. (*Note, only 41 packages are needed if   0.8 )
 H 0 :   0  55
 H a :   55
(b) 
s  0.8, n  64,   0.01 . X  55.2 .
z0 
X  0 55.2  55
X  0 H 0

 2 . (*Note, Z 0 
~ N  0,1 -- This is the large sample z-test by the central limit
s / n 0.8 / 64
s/ n
theorem that is suitable even if the population distribution is not normal.)
Since z0  2  Z0.01  2.326 , we can not conclude that the speedometers have a bias.
(**Note: Here you can also use the t-test – but remember to mention that the t-test is suitable if we assume the population
distribution is normal!)
(c)   0.8,   0.01, n  50
 H 0 :   0  55

 H a :   a  55.5  55
Power  P (reject H 0 | H a )
 P ( Z 0  z0.01 |   55.5)
X  0
 z0.01 |   55.5)
/ n
X  a
  0
 P(
 z0.01  a
|   55.5)
/ n
/ n
 P(
55.5  55
)
0.8 / 50
 P ( Z  2.09)  0.9817
 P ( Z  2.326 
iid
3. (for all students). We have two independent samples X1 ,
, X n1 ~ N ( 1 , 12 ) and Y1 ,
iid
, Yn2 ~ N (2 ,  22 ) ,
 H 0 : 1  2  0
 H a : 1  2    0
where  12   2 2   2 and n1  n1  n . For the hypothesis of 
a) Please derive the general formula for power calculation for the pooled variance t-test based on an effect size
of EFF at the significance level of α.
Recall - Definition: Effect size = EFF =

(e.g. Eff=1)

b) With a sample size of 15 per group, α = 0.05, and an estimated effect size ranging from 1 to 1.5, please
calculate the power of your pooled variance t-test.
Solution:
a) T.S : T0 =
(X Y)  0
( X  Y ) H0

~ t2 n  2
1 1
2
Sp

Sp
n1 n2
n
At α=0.05, reject H 0 in favor of H a iff T0  t2 n  2,
Power = 1-β = P(reject H 0 | H a ) = P(T0  t2 n  2, | H a : 1  2    0)
= P(
= P(
(X Y)
 t2 n  2, | H a : 1  2  )
2
Sp
n
(X Y)  

 t2 n 2, 
| H a : 1  2  )
2
2
Sp
Sp
n
n
≈ P(T  t2 n2,  Eff *


n
)
| H a : 1  2  ) (Effect size = 
 Sp
2
b) With n = 15, α = 0.05, Eff = 1 to 1.5, the power is calculated as follows:
Power (Eff = 1) = P(T  t28,0.05  1*
15
| H a : 1  2  )
2
= P(T  1.701  2.739)  P (T  1.038)  0.846
Power (Eff = 1.5) = P(T  t28,0.05  1.5*
15
| H a : 1  2  )
2
= P(T  1.701  4.108)  P(T  2.407)  0.989
Note: the T statistic above follows a t-distribution with 28 (=15+15-2) degrees of freedom.
Therefore we conclude that the power will range from 84.6% to 98.9% for a given effect size of 1 to 1.5.