Académique Documents
Professionnel Documents
Culture Documents
Topic 8
1
J & B : Chapter 10
(Small sample procedures only)
Example:
Identical laboratory rats are randomly
divided into two groups.
Each group is fed a different diet.
After a certain time period, the
weight gain (in g) of each rat is taken.
Summary statistics:
Sample 1: x1 = 101.00 , s1 = 20.632 , n1 = 7
Sample 2: x2 = 122.08 , s2 = 20.962 , n2 = 13
Visual summary:
(i) Comparative boxplots
Diet2 appears to
give a higher result
than Diet1 4
There are two possibilities for reality:
σ 12
X ~ N ( µ1 , σ 2
1 ) and X 1 ~ N µ1 ,
n1
X 1 − X 2 ~ Normal
( ) ( ) ( )
E X1 − X 2 = E X1 − E X 2
= µ1 − µ2
8
Therefore, for independent samples:
σ 12 σ 22
X 1 − X 2 ~ N µ1 − µ 2 , +
n1 n2
or
(X 1 )
− X 2 − ( µ1 − µ2 )
~ N ( 0,1)
σ 2
σ 2
1
+ 2
n1 n2
9
So, if the two samples come from
populations with the same mean,
i.e. if H0 is true (µ1-µ2 = 0), then:
(X 1 −X2 ) ~ N ( 0,1) ~ Z
σ 12 σ 22
+
n1 n2
(X 1 − X2 ) ~ N ( 0,1) ~ Z
1 1
σ +
2
n1 n2
10
σ1 and σ2 known:
If σ1 and σ2 are known, a z-test
could be carried out (whether the
σ’s are equal or not).
11
σ1 and σ2 unknown:
To carry out a traditional t-test we
need to assume that σ12 = σ22 .
Estimated variance:
2 1 1
est.Var ( X 1 − X 2 ) = s p × +
n1 n2
Standardising:
(X 1 )
− X 2 − ( µ1 − µ2 )
~t
1 1 n1+n2 −2
sp + 14
n1 n2
If H0 is true (µ1 - µ2 = 0), then:
(X 1 −X2 ) ~t
1 1 n1+n2 −2
sp +
n1 n2
tobs =
( x1 − x2 )
1 1
sp +
n1 n2
where
16
Compare p with α and Reject H0 if p ≤ α
The test can be one or two tailed depending
on what you are interested in.
The procedure is the same as for any
hypothesis test. The only difference is in
the calculation of the test statistic.
H hypotheses
A assumptions
T test statistic
P p-value
C conclusion
We will do a few more additional (small)
17
steps ...
Putting it all together:
(1) Identify the random variable and what the
groups (populations) are
α = 0.05
Data summary:
Diet 1: n1 = 7, x1 = 101.00, s1 = 20.632
Diet 2: n2 = 13, x2 = 122.08, s2 = 20.962
Assume:
• independent observations
• X is normally distributed
• σ1 = σ2 (two populations have equal standard deviations)
19
Test = two-independent samples t-test
use as accurate
Test statistic is: figures as possible in
your calculations
t=
(X 1 − X2 )
with df = n1 + n2 − 2
1 1
Sp +
n1 n2
6 × (20.632) 2 + 12 × (20.962)2
≈
18
∴ Reject H0
We can conclude at the 5% level of
significance that the two diets do not have
an equal effect on the average weight gain
of the rats.
In fact, Diet2 results in a significantly
higher average weight gain than Diet1.
Note that a one tailed test could be
an option under certain
circumstances. However, in this
case, a two tailed test was required.
21
α)% C.I. for µ1-µ
100(1-α µ2:
In this case:
1 1
( x1 − x2 ) ± tn1+ n 2−2 × s p +
n1 n2
22
For the example:
95% confidence interval for µ1-µ
µ2 is:
1 1
(101.00 − 122.08 ) ± t18 × 20.8526 × +
7 13
= ( −21.08 ± 20.539 )
= ( − 41.62 , − 0.54 )
23
The confidence interval can be used for a
two tailed test of significance.
H0: µ1 = µ2 OR H0: µ1-µ
µ2 = 0
H1: µ1 ≠ µ2 H1: µ1-µ
µ2 ≠ 0
24
Assumptions for two-sample t-test:
25
Checking σ1 = σ2:
General “rough” rule:
The ratio slarger /ssmaller should be less than ~2.
Some other books “Rule of thumb”
Look at the comparative boxplots and
compare the lengths of the boxes (IQR)
27
Alternative
hypothesis
≠,<,>
Name the
output
columns,
c3 and c4
something
sensible. 29
Result of “Stacking”
30
MTB > TwoT 'wtgain' 'DietNo';
SUBC> Pooled.
Two-Sample T-Test and CI: wtgain, DietNo
Two-sample T for wtgain
DietNo N Mean StDev SE Mean
1 7 101.0 20.6 7.8
2 13 122.1 21.0 5.8
Difference = mu (1) - mu (2)
Estimate for difference: -21.08
95% CI for difference: (-41.62, -0.54)
T-Test of difference = 0 (vs not =):
T-Value = -2.16 P-Value = 0.045 DF = 18
Both use Pooled StDev = 20.8526 31
Checking Normality:
MTB Graph Probability Plot Multiple
32
Checking Normality:
Clearly, the
assumption of
normality for
both groups
here is fine.
33
Why separate Normality plots for
each sample?
We need to obtain separate Normality plots for
each sample, as they could easily have different
Normal distributions.
We must assume they have the same variance, but
they could have different means.
Example:
Two samples (n=20) were generated in Minitab:
same variance ( 52 ), different means (100 , 130).
Descriptive Statistics:
Variable N Mean StDev Min Med Max
N(100,5sq) 20 100.20 10.73 85 97 122
N(130,5sq) 20 131.94 6.71 121 131 151
Boxplot of N(100, 5sq), N(130,5sq)
N(100, 5sq)
N(130,5sq)
60
50
40
30
20
10
1
50 75 100 125 150 175
Both
. 95
90
N(100, 5sq)
N(130,5sq)
Mean StDev N AD P
100.2 10.73 20 0.583 0.114
80 131.9 6.706 20 0.406 0.319
70
Percent
60
50
40
30
20
10
1
60 70 80 90 100 110 120 130 140 150
Data
35
Another simulated example
Two samples each of size 200 were simulated.
Both had σ = 10, but µ1 = 100, and µ2 = 130
Descriptive Statistics: N(100,10^2), N(130,10^2)
36
“Modified” (= “unpooled”) t-test:
Example: Obtaining the concentration of a
chemical by two different methods.
Does the new, faster method
give the same measure of
concentration as the standard
method (which is known to be accurate)?
Standard method:
25 24 25 26
New method:
23 18 22 28 17 25 19 16
Testing: H0: µ1 = µ2
H1: µ1 ≠ µ2 α = 0.05
Data summary:
x1 = 25.0 s1 = 0.816 n1 = 4
x2 = 21.0 s2 = 4.209 n2 = 8 37
Check ratio of the standard deviations
slarger = 4.201 ≈ 5.13 >> 2
ssmaller 0.819
x1 − x 2
with observed value t
'
obs =
2 2
s s
1
+ 2
n1 n 2
Compare t' with the t distribution with d.f.
given by Do NOT put this on your summary sheet.
It is included for completeness only!
(It was requested by some students in the past.)
( ( n) ( n) )
2
s12 + s2
2
1 2
df =
( n) ( )
2 2
s 12 (n1-1) + s2
2
(n2-1)
1 n2 39
This df is called the Smith-Satterthwaite
modification.
Historically Smith-Welch-Satterthwaite:
Smith(1936), Journal of CSIR,
Welch(1938), Biometrika,
Satterthwaite(1946), Biometrics.
Note:
the d.f are often not going to be an integer.
- Just get Minitab to do it.
By hand, take
df = min(n1-1, n2-1)
= min(n1, n2) – 1
42
Finishing the hypothesis test …
Decision: based on Minitab calculations,
reject H0 (at a 5% significance level).
49
The actual randomisation of the
experimental units is usually
carried out using random
numbers.
Resulting 7 id’s
for Tmt1
MTB> Print C2
14 3 18 10 7 6 13
Tmt2 would have
the other 13 id’s:
1, 2, 4, 5,
8, 9, 11,
12, 15, 16, 51
17, 19, 20
Further explanation of randomisation
(from Discussion Board in 2009)
Randomisation is simply the
procedure by which the experimental
units are allocated to the treatments.
The use of random numbers (or a
procedure implemented in Minitab) is
to save having to write out id tags
(e.g. slips of paper) for the units, put
them in a “hat”, shuffle them and
draw them out.
It is very important to allocate
subjects from a “pool” at random to
the treatments, to avoid
“confounding” (the situation where
differences can be explained by more
52
than one causal factor).
Example
Suppose there are 26 rats in a cage to
be allocated to two treatment groups.
We wish to see if the rats maze-
navigating results differ by whether
they are rewarded with chocolate or
with cheese during the “training”
sessions.
Each rat would have an id tag. Each
id would be randomly allocated to the
treatment groups such as by tossing a
coin and setting:
• Head chocolate reward group
58
So the randomisation is done in
such a way that half the
experimental units are assigned
to one treatment, and the other
half to the other treatment.
The principal of “restricted
randomisation” can be extended
even further (essentially it is a
matter of common sense).
For example:
Suppose that of the 26 rats:
• 16 are male
and
• 10 are female
59
We want to allocate rats to the two
treatment groups, ensuring the rats
are as identical as possible
regarding their characteristics in
the two groups ...
63
Here there are differences between the
pairs (they are all different weights).
This won’t cause problems in the analysis,
as we have “removed” the variability in
weight gain due to initial weight.
Within each pair, we assume the rats have identical properties.
Diet1
2 thinnest random
Diet2 64
Pairing example (Captopril):
The effect of the drug Captopril
on blood pressure was assessed
by recording the (initial) blood pressure on
15 hypertensive patients. They were then
given Captopril and their blood pressure
was measured two hours later. Does the
drug have any effect on blood pressure?
Patient before after
1 130 125
2 122 121
3 124 121
4 104 106
5 112 101
6 101 85
7 121 98
8 124 105
9 115 103
10 102 98
11 98 90
12 119 98
13 106 110
14 107 103 65
15 100 82
An appropriate visual display is a line plot
in Minitab.
MTB > Graph > Line plot
df = 15 - 1 = 14
60
50
40
30
20
10
1
-20 -10 0 10 20 30 40
72
diff
Using Minitab:
Stat Basic Statistics Paired t
Q: If we did
have the
differences in a
column, what
would we do?
81
If the individuals have uniform
characteristics / properties – a paired
design is unnecessary.
Paired is often:
• harder to set up
• requires equal replication
• has fewer degrees of freedom