Transcript week11

Power of the t-test
- Example
• In a metropolitan area, the concentration of cadmium (Cd) in leaf
lettuce was measured in 7 representative gardens where sewage
sludge was used as fertilizer. The following measurements (in
mg/kg of dry weight) were obtained.
Cd: 21 38 12 15 14 8 10
• Is there strong evidence that the mean concentration of Cd is
higher than 12 ?
Descriptive Statistics
Variable
Cd
N
7
Mean
16.86
Median
14.00
TrMean
16.86
StDev
10.21
• The hypothesis to be tested are: H0: μ = 12 vs
• The test statistics is:
SE Mean
3.86
Ha: μ > 12.
degrees of freedom = 7 – 1 = 6
week 11
1
• Since t = 1.26 < 1.943, we cannot reject H0 at the 5% level and so
there are no strong evidence.
The P-value is 0.1 < P(T(6) ≥ 1.26) < 0.15 and so is greater then
0.05 indicating a non significant result.
• Find the power of the test when true mean is 13.
We can use MINITAB to calculate the power for t-tests.
MINITAB commands: Stat > Power and Sample size > 1 sample t
1-Sample t Test
Testing mean = null (versus > null)
Calculating power for mean = null + 1
Alpha = 0.05 Sigma = 10.21
Sample Size
Power
7
0.0788
week 11
2
• What is the probability of a type II error when  = 13?
• Find the power of the test when true mean is 20.
Testing mean = null (versus > null)
Calculating power for mean = null + 8
Alpha = 0.05 Sigma = 10.21
Sample Size
Power
7
0.5749
• Use the tables to find the power when  = 20.
• Find the sample size if we specified a desired power of 0.90,
when the true mean is 20.
1-Sample t Test
Testing mean = null (versus > null)
Calculating power for mean = null + 8
Alpha = 0.05 Sigma = 10.21
Sample Size
Target Power
Actual Power
16
0.9000
0.9104
week 11
3
Match Pairs t-test
• In a matched pairs study, subjects are matched in pairs and the
outcomes are compared within each matched pair. The
experimenter can toss a coin to assign two treatment to the two
subjects in each pair. Matched pairs are also common when
randomization is not possible. One situation calling for match
pairs is when observations are taken on the same subjects,
under different conditions.
• A match pairs analysis is needed when there are two
measurements or observations on each individual and we want
to examine the difference.
• For each individual (pair), we find the difference d between
the measurements from that pair. Then we treat the di as one
sample and use the one sample t – statistic to test for no
difference between the treatments effect.
• Example: similar to exercise 7.41 on p482 in IPS.
week 11
4
Data Display
Row
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Student
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Pretest
30
28
31
26
20
30
34
15
28
20
30
29
31
29
34
20
26
25
31
29
Posttest
29
30
32
30
16
25
31
18
33
25
32
28
34
32
32
27
28
29
32
32
improvement
-1
2
1
4
-4
-5
-3
3
5
5
2
-1
3
3
-2
7
2
4
1
3
week 11
5
• One sample t-test for the improvement
T-Test of the Mean
Test of mu = 0.000 vs mu > 0.000
Variable
N
Mean
StDev
SE Mean
improvem 20
1.450
3.203
0.716
T
2.02
P
0.029
• MINITAB commands for the paired t-test
Stat > Basic Statistics > Paired t
Paired T-Test and Confidence Interval
Paired T for Posttest – Pretest
N
Mean
StDev
SE Mean
Posttest
20
28.75
4.74
1.06
Pretest
20
27.30
5.04
1.13
Difference
20
1.450
3.203
0.716
95% CI for mean difference: (-0.049, 2.949)
T-Test of mean difference=0 (vs > 0):
T-Value = 2.02 P-Value = 0.029
week 11
6
6
Frequency
5
4
3
2
1
0
-4
-2
0
2
4
6
8
improvement
Character Stem-and-Leaf Display
Stem-and-leaf of improvement
Leaf Unit = 1.0
2
-0 54
4
-0 32
6
-0 11
8
0 11
(7)
0 2223333
5
0 4455
1
0 7
week 11
N
= 20
7
Inference for non-normal populations
• Three general strategies are available for making inference about the
mean of a clearly non-normal distribution based on small sample.
 In some cases a distribution other than a normal distribution will
describe the data well. There are many non-normal models for data,
and inference procedures for these models are available.
 Because skewness is the chief barrier to the use of t procedures on
data without outliers, we can attempt to transform skewed data so
that the distribution is symmetric and as close to normal as possible.
CI and P-values from the t procedures applied to the transformed
data will be quite accurate for even moderate sample size.
 The third strategy is to use a distribution-free inference procedure.
Such procedures do not assume that the population distribution has
any specific form, such as normal. Distribution-free procedures are
often called nonparametric procedures.
week 11
8
The sign test for matched pairs
• One way of analyzing nonnormal data is to use a distributionfree procedure, or nonparametric procedure.
• Distribution-free (nonparametric) tests have two drawbacks;
 They are generally less powerful than the test designed for
use with a specific distribution such as t-test.
 We must often modify the statement of the hypothesis in
order to use the distribution free test.
• The simplest distribution free test, and one of the most useful,
is the sign test.
• Example
Use a sign test to test whether attending the Institute improves
listening skills (In Exercise 7.41 above).
week 11
9
Solution
Step-1: Calculate the differences (post-pre). Ignore pairs with
difference 0.
Step-2: Count the number of positive differences (X). In our
example X=14. The test statistic of the sign test, is the
count X of pairs with positive differences. Under the null
hypothesis X ~ Bin (20, ½). P-values for X are based on
this distribution.
Step-3: Test the hypothesis: H0: p = 0.5 vs
Ha: p > 0.5
where p is the probability of a positive difference.
• Note that this is a test of
H0: population median = 0 vs
Ha: population median > 0.
week 11
10
• The P-value for this test is given by
P(X ≥14) = 0.0370+0.0148+0.0046+0.0011+0.0002=0.0577
• MINITAB commands for the sign test
Stat > Nonparametrics > 1 sample sign
• The MINITAB output for the above problem is given below.
Sign Test for Median
Sign test of median = 0.00000 versus > 0.00000
N Below Equal Above
P
Median Diff.
20
6
0
14
0.0577
2.000
week 11
11
Two-sample problems
• The goal of inference is to compare the response in two groups.
• Each group is considered to be a sample form a distinct
population.
• The responses in each group are independent of those in the
other group.
• A two-sample problem can arise form a randomized
comparative experiment or comparing random samples
separately selected from two populations.
• Example:
A medical researcher is interested in the effect of added calcium
in our diet on blood pressure. She conducted a randomized
comparative experiment in which one group of subjects receive
a calcium supplement and a control group gets a placebo.
week 11
12
Comparing two means (with two independent samples)
• Here we will look at the problem of comparing two population means
when the population variances are known or the sample sizes are large.
Suppose that a SRS of size n1 is drawn from an N( μ1, σ1) population
and that an independent SRS of size n2 is drown from an N( μ2, σ2)
population. Then the two-sample z statistics for testing the null
hypothesis H0: μ1 = μ2 is given by

x1  x2   1   2 
z

2
1
 
n1   22 n2

and has the standard normal N(0,1) sampling distribution.
• Using the standard normal tables, the P-value for the test of H0 against
Ha : μ1 > μ2 is P( Z ≥ z )
Ha : μ1 < μ2 is P( Z ≤ z )
Ha : μ1 ≠ μ 2 is 2·P(Z ≥ |z|)
week 11
13
Example
• A regional IRS auditor runs a test on a sample of returns filed
by March 15 to determine whether the average return this year
is larger than last year. The sample data are shown here for a
random sample of returns from each year.
Last Year
This Year
Mean
380
410
Sample size
100
120
• Assume that the std. deviation of returns is known to be about
100 for both years. Test whether the average return is larger
this year than last year.
week 11
14
Solution
week 11
15
Comparing two population means
(unknown std. deviations)
• Suppose that a SRS of size n1 is drawn from a normal
population with unknown mean 1 and that an independent
SRS of size n2 is drawn from another normal population with
unknown mean 2. To test the null hypothesis H0: 1 = 2, we
compute the two sample t-statistic
t
x1  x2  1   2 
s
2
1
 
n1  s n2
2
2

• This statistic has a t-distribution with df approximately equal
to smaller of n1 – 1 and n2 - 1. We can use this distribution to
compute the P-value.
week 11
16
Example
• The weight gains for n1 = n2 = 8 rats tested on diets 1 and 2 are
summarized here. Test whether diet 2 has greater mean weight
gain. Use the 5% significant level.
n
Std dev.
mean
Diet 1
8
.033
3.1
Diet 2
8
0.070
3.2
• The hypotheses to be tested are: H0: μ1 = μ2 vs
• The test statistic is
week 11
Ha: μ1 < μ2 .
17
• The P-value is P(T(7) ≤- 3.65) = P(T(7) ≥ 3.65) , from table D
we have 0.005 < P-value < 0.01 and so we reject H0 and
conclude that the mean weight gain from diet 2 is significantly
greater than that from diet 1 (at the 5% and 1% significant
level).
• A C% CI for the difference between the two means is given by,
x1  x2  t

s12 s22

n1 n2
• For this example the 95% CI is
week 11
18
The pooled two sample t-procedures
• If the two normal population distributions have the same std
deviation, i.e. σ1= σ2 =  , then we can estimate the common
stdev. by,
sp 
n1  1s
 n2  1s
n1  n2  2
2
1
2
2
• This is called the pooled estimator of σ2, it combines the
information in both samples.
• The pooled two-sample t statistic is then,
x  x  (   )
1 2
t 1 2
s p n1  n1
1 2
and has exactly a t-distribution with df = n1 + n2 – 2 .
week 11
19
Example
• In a study of heart surgery, one issue was the effects of drugs
called beta blockers on the pulse rate of patients during
surgery. The available subjects were divided into two groups
of 30 patients each. The pulse rate of each patient at a critical
point during the operation was recorded. The treatment group
had mean 65.2 and std dev. 7.8. For the control group the mean
was 70.3 and the std dev. was 8.3.
a) Do beta-blocker reduce the pulse rate?
b) Give a 99% CI for the difference in mean pulse rates.
• Denoting the control group as 1 and the treatment group as 2
the solution is …
week 11
20
a) The hypotheses to be tested are: H0: μ1 = μ2 vs
The pooled standard deviation is
Ha: μ1 > μ2 .
29  8.32  29  7.82
sp 
 8.05
30  30  2
and the test statistic is

70.3  65.2  0
t
 2.45
8.05 2 30
The P-value is P(T(58) ≥ 2.45), using table D and df = 60 we get
0.005 < P-value < 0.01 and so we have significant evidence
that the mean pulse rate of the control group is higher than the
mean of the treatment group at the 5% and 1% significant
level. Does it mean that beta-blocker reduce the pulse rate?!
week 11
21
b) A C level CI’s for μ1 – μ2 is given by

x1  x2  t s p
1 1

n1 n2
For this example, a 99% CI is ,
70.3  65.2  2.66  8.05
1 1

30 30
= (-0.429 , 10.629 )
• MINITAB command: Stat > Basic Statistics > 2 Sample t .
week 11
22
Example
• A study compared various characteristics of 68 healthy and 33
failed firms. One of the variables was the ratio of current
assets to current liabilities.
Row
1
2
3
Firms(Healthy/Failed) Ratio
h
1.50
h
0.10
h
1.76
...
99
100
101
f
f
f
0.13
0.88
0.09
week 11
23
Stem-and-leaf of Ratio
failed
N
= 33
Leaf Unit = 0.10
5
7
11
12
(10)
11
5
3
2
1
1
0
0
0
0
0
1
1
1
1
1
2
00111
22
4455
6
8888899999
111111
33
4
6
0
week 11
24
Stem-and-leaf of Ratio
healthy
N
= 68
Leaf Unit = 0.10
1
2
2
4
10
15
19
26
34
34
23
16
10
7
3
2
0
0
0
0
0
1
1
1
1
1
2
2
2
2
2
3
1
2
66
899999
00011
2223
4445555
66666777
88888889999
0000111
222223
455
6677
8
01
week 11
25
Two Sample T-Test and Confidence Interval
Two sample T for Ratio
Firms
N
Mean
StDev
SE Mean
failed
33
0.824
0.481
0.084
healthy 68
1.726
0.639
0.078
95% CI for mu (f) - mu (h): ( -1.129, -0.675)
T-Test mu (f) = mu (h) (vs <):
T = -7.90 P = 0.0000 DF = 81
Two Sample T-Test and Confidence Interval (pooled test and CI)
Two sample T for Ratio
Firms(He
N
Mean
StDev
SE Mean
f
33
0.824
0.481
0.084
h
68
1.726
0.639
0.078
95% CI for mu (f) - mu (h): ( -1.151, -0.652)
T-Test mu (f) = mu (h) (vs <):
T = -7.17 P = 0.0000 DF = 99
Both use Pooled StDev = 0.593
week 11
26