Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Treatment Comparisons
Department of Statistics
National Chengchi University
Taipei 11605, Taiwan
E-mail: chengt@nccu.edu.tw
Outline
t
X
C= ki µi = k1 µ1 + k2 µ2 + · · · + kt µt
i =1
where
t
X
ki = 0.
i =1
I. Contrast for three specific questions
• Commercial wrap vs. artificial atmospheres:
1 1 1 1 h i0
C1 = µ1 − (µ2 +µ3 +µ4 ) = [1, − , − , − ] µ1 µ2 µ3 µ4
3 3 3 3
or C1∗ = 3µ1 − (µ2 + µ3 + µ4 )
• Vacuum vs. gases:
1 1 1 h i0
C2 = µ2 − (µ3 + µ4 ) = [0, 1, − , − ] µ1 µ2 µ3 µ4
2 2 2
or C2∗ = 2µ2 − (µ3 + µ4 )
• Mixture gases vs. pure CO2
h i0
C3 = µ3 − µ4 = [0, 0, 1, −1] µ1 µ2 µ3 µ4
II. Estimating and testing contrasts
• a) Point estimator
t
X t
X
Ĉl = kli µ̂i = kli ȳi .
i =1 i =1
• The estimates for the three contrasts
t
X 1
Ĉ1 = k1i µ̂i = ȳ1. − (ȳ2. + ȳ3. + ȳ4. )
3
i =1
Pt
or Ĉ1∗ = i =1 k1i µ̂i = 3ȳ1. − (ȳ2. + ȳ3. + ȳ4. )
t
X 1
Ĉ2 = k2i µ̂i = ȳ2. − (ȳ3. + ȳ4. )
2
i =1
Pt
or Ĉ2∗ = i =1 k2i µ̂i = 2ȳ2. − (ȳ3. + ȳ4. )
t
X
Ĉ3 = k3i µ̂i = ȳ3. − ȳ4.
II. Estimating and testing contrasts (continued)
t t t
X X s 2 X k2 i
sĈ2 = ki2 sȳ2i . = ki2 =s 2
ri ri
i =1 i =1 i =1
t t X k2 t
X X s2 li
s2 = kli2 sȳ2i . = kli2 = s2
Ĉl ri ri
i =1 i =1 i =1
II. Estimating and testing contrasts (continued)
• c) Notice that
Ĉ − C
∼ tN −t
sĈ
and
!2
Ĉ − C
∼ F1,N −t
sĈ
Pt
• Sum of squares attributed to the contrast Cl = i =1 kli µi is
• Note: Also
(Ĉl )2
SSCl =
s 2 /s 2
Ĉl
III. (continued)
• To test
(
H0 : Cl = 0
H0 : Cl , 0
• t-test:
• Test statistic:
Ĉl
t=
sĈl
• Rejection region:
• F -test:
• Test statistic:
(Ĉi )2
2
s 2 /s 2
MSCl SSCl /1 Ĉi Ĉl
F= = = =
MSE s2 s2 sĈl
• Rejection region:
IV. Orthogonal contrasts
Pt Pt
• Let Cl = i =1 kli µi and Cm = i =1 kmi µi be two different
contrasts.
• They are orthogonal contrasts if
t
X kli kmi
= 0.
ri
i =1
1 1 1 1 1 1 1 1
[1, − , − , − ][0, 1, − , − ]0 = − + + = 0
3 3 3 2 2 3 6 6
1 1 1 1 1
[1, − , − , − ][0, 0, 1, −1]0 = − + = 0
3 3 3 3 3
1 1 1 1
[0, 1, − , − ][0, 0, 1, −1] = − + = 0
2 2 2 2
• Hence, C1 = µ1 − 31 (µ2 + µ3 + µ4 ), C2 = µ2 − 12 (µ3 + µ4 ), and
C3 = µ3 − µ4 are orthogonal contrasts.
• SSTR = 3l =1 SSCl .
P
Example: Meat storage - SAS
options LS=80 nocenter nodate nonumber;
data steak;
input method logcnt@@;
cards;
1 7.66 1 6.98 1 7.80
2 5.26 2 5.44 2 5.80
3 7.41 3 7.33 3 7.04
4 3.51 4 2.91 4 3.66
;
proc glm;
class method;
model logcnt = method;
lsmeans method;
means method;
TITLE2 ’Estimating Contrasts’;
estimate ’C1’ method 1 -0.3333 -0.3333 -0.3334;
estimate ’C2’ method 0 1 -0.5 -0.5;
estimate ’C3’ method 0 0 1 -1;
estimate ’C1*’ method 3 -1 -1 -1;
estimate ’C2*’ method 0 2 -1 -1;
TITLE2 ’Tests for Contrasts’;
CONTRAST ’ C1’ method 1 -0.3333 -0.3333 -0.3334;
CONTRAST ’ C2’ method 0 1 -0.5 -0.5;
CONTRAST ’ C3’ method 0 0 1 -1;
CONTRAST ’ C1*’ method 3 -1 -1 -1;
CONTRAST ’ C2*’ method 0 2 -1 -1;
RUN;
Meat storage - Output
Level of ------------logcnt-----------
method N Mean Std Dev
1 3 7.48000000 0.43863424
2 3 5.50000000 0.27495454
3 3 7.26000000 0.19467922
4 3 3.36000000 0.39686270
Standard
Parameter Estimate Error t Value Pr > |t|
C1 2.10686800 0.22691163 9.28 <.0001
C2 0.19000000 0.24067613 0.79 0.4526
C3 3.90000000 0.27790886 14.03 <.0001
C1* 6.32000000 0.68073490 9.28 <.0001
C2* 0.38000000 0.48135226 0.79 0.4526
Remarks
• t=3, r1 = 9, r2 = 6, r3 = 8.
• Let C1 = µ1 − 12 (µ2 + µ3 ) and C2 = µ2 − µ3 be two contrasts.
• Since 3i =1 klirkmi = 09 − 16 + 81 , 0 =⇒ they are not
P
i
orthogonal.
• Let C1 = 7µ1 − 3µ2 − 4µ3 and C2 = µ2 − µ3 .
• Then, 3i =1 klirkmi = 90 − 36 + 48 = 0, so they are orthogonal
P
i
contrasts.
SAS
• options nocenter nodate nonumber;
data phlebitis;
input method y@@;
cards;
1 2.2 1 1.6 1 0.8 1 1.8 1 1.4 1 0.4 1 0.6 1 1.5 1 0.5
2 0.3 2 0.0 2 0.6 2 0.0 2 -0.3 2 0.2
3 0.1 3 0.1 3 0.2 3 -0.4 3 0.3 3 0.1 3 0.1 3 -0.5
;
proc glm;
class method;
model y = method/solution e;
estimate ‘A-V’ method 1 -1 0;
estimate ‘V-S’ method 0 1 -1;
contrast ‘A-V’ method 1 -1 0;
contrast ‘V-S’ method 0 1 -1;
run;
estimate ’C1’ method 7 -3 -4;
estimate ’C2’ method 0 1 -1;
contrast ’C1’ method 7 -3 -4;
contrast ’C2’ method 0 1 -1;
run;
Meat storage - Output
Level of --------------y--------------
method N Mean Std Dev
1 9 1.20000000 0.64226163
2 6 0.13333333 0.30767949
3 8 0.00000000 0.28784917
Standard
Parameter Estimate Error t Value Pr > |t|
C1 8.00000000 1.39531624 5.73 <.0001
C2 0.13333333 0.25196450 0.53 0.6025
註: C1 and C2 are orthogonal contrasts, SS(C1)+SS(C2)=SSTR
Remarks
t2 − 1
" 2 #
x − x̄
P2 (x) = λ2 −
d 12
Orthogonal polynomial regression (continued)
• Cubic:
x − x̄ 3t 2 − 7
" 3 #
x − x̄
P3 (x) = λ3 −
d d 20
• Quartic
x − x̄ 2 3t 2 − 13 3(t 2 − 1)(t 2 − 9)
" 4 ! #
x − x̄
P4 (x) = λ4 − +
d d 14 560
• Pci ≡ Pc (xi )
• xi is the i th level
• the matrix X 0 X is a diagonal matrix
Pt .P
t 2
• Note: For balanced design β̂c = i =1 Pci ȳi . i =1 Pci .
Remark 2
10 − x̄ 10 − 30
P1 (10) = λ1 = λ1 = −2λ1 =⇒ λ1 = 1
d 10
2 10 − 30 2 52 − 1
x − x̄ 2 t − 1
P2 (10) = λ2 − = λ2 − = 2λ =⇒ λ = 1
2 2
d 12 10 12
x − x̄ 3 x − x̄ 3t 2 − 7 10 − 30 3 10 − 30 3 × 52 − 7
P3 (10) = λ3 − = λ
3 −
d d 20 10 10 20
αE = 1 − (1 − αC )n (3.24a)
αC = 1 − (1 − αE )1/n (3.24b )
t
X
Ĉ ± tαE / (2n );N −t × sĈ , where Ĉ = ki ȳi .
i =1
• Remark:
• If n is large, then tαE / (2n );N −t might be big.
• Bonferroni’s method can be used safely for a small number
of pre-planned contrasts.
II. Scheffe t statistic or Scheffe method
• Scheffe proposed a method to construct simultaneous
confidence intervals or simultaneously test all possible
contrasts.
• This method is quite conservative and is often used for
examining unplanned contrasts or contrasts suggested by
the data.
• The 100(1-αE )% simultaneous C.I. for contrast C with
Scheffe method is
q
Ĉ ± sĈ (t − 1)FαE ;t−1,N −t ,
q
k2
where Ĉ = i =1 ki ȳi . , and sĈ = MSE × ti=1 ri .
Pt P
i
• Note:
• Based on Scheffe method, H0 : C = 0 is rejected
p
if |Ĉ | > sĈ(t − 1)FαE ;t−1,N −t .
p
• The Scheffe statistic is sĈ (t − 1)FαE ;t−1,N −t .
3.6 Multiple Comparisons with the Best Treatments
H0 : µi − µc = 0 H0 : µ i − µ c ≤ 0 H0 : µ i − µ c ≥ 0
Ha : µi − µc ,0 Ha : µi − µc >0 Ha : µ i − µ c < 0
Reject H0 |ȳi . − ȳc. | > D (k , αE ) ȳi . − ȳc. > D (k , αE ) ȳi . − ȳc. < −D (k , αE )
Example 3.2 Flow rates through filters
ȳi . − ȳc. ± D (k , αE )
!
t t (t−1)
• There are = 2 pairwise mean differences µi − µl ,
2
for all i , l .
I. Tukey’s HSD (honestly siginificant difference)
• Tukey developed this method to obtain 100(1-αE )%
simultaneous CIs, which is based on the Studentized range
statistic for balanced case:
,r 2
s
q = ȳ(t ) − ȳ(1) , where ȳ(t ) = max ȳi . , ȳ(1) = min ȳi .
r i =1,···t i =1,···t
q
MSE 1
• qαE ;t,nT −t + 1r ) for balanced design
2 (r
• Conclude that that µi and µj differ if ȳi . − ȳj . > HSD (t, αE )ij .
• 100(1-αE )% simultaneous CIs of µi − µj , for all i , j , are
Method
A D C B
Method Mean 69 71 75 83 k q0.05;k ,16 SNK (k , 0.05)
A 69 – 2 6 14* 4 4.05 7.02
D 71 – 4 12* 3 3.65 6.32
C 75 – 8* 2 3.00 5.20
B 83 –
• From SNK method, B is significantly different to all others;
while A, C, and D are not significantly different.
ADCB
• LSD
More example
More example on using SAS
OPTIONS LS=80 NODATE NONUMBER;
data eggwt;
input trt$ @;
do repeat = 1 to 10;
input eggwt @;
output;
end;
cards;
A 37 32 31 46 44 38 36 33 40 33
B 49 43 52 52 50 53 46 42 56 47
C 43 33 48 45 46 42 46 40 44 43
D 47 41 54 49 44 52 46 45 54 38
E 40 31 44 34 44 36 51 43 37 40
;
proc glm;
class trt;
model eggwt=trt;
means trt/lsd;
means trt/tukey;
means trt/dunnett;
means trt/snk;
means trt/scheffe;
means trt/duncan;
lsmeans trt/pdiff stderr;
contrast ’TRT-E vs. OTHERS’ trt -1 -1 -1 4;
contrast ’TRT-D vs. OTHERS’ trt -1 -1 4 -1;
contrast ’TRT-CE vs. TRT-ABD’ trt -2 -2 3 -2 3;
contrast ’TRT-A vs. OTHERS’ trt -1 -1 -1 -1;
run;
Output 1
• Bool’s inequality: P ( ∞
S P∞
i =1 Ai ) ≤ i =1 P (Ai )
• Bonferroni’s inequality: P ( ki=1 Ai ) ≥ 1 − ki=1 P (Ai0 )
T P
y = β0 + β1 x + β2 x 2 + β3 x 3 + β4 x 4 + ε
Parameter Estimates
Variable DF Parameter Standard t Value Pr > |t|
Estimate Error
Intercept 1 5.80000 1.12359 5.16 0.0002
density 1 0.72000 0.08562 8.41 <.0001
den2 1 -0.01000 0.00140 -7.14 <.0001
Tolerance or Variance Inflation Factor
• The standard multiple regression with (p − 1) explanatory
variables, the output often provides a diagnostic measure
of the collinearity of a predictor with the other predictors
in the model, either the tolerance (TOL) or the variance
inflation factor (VIF).
• Tolerance (TOL) : TOL = 1 − Rk2
• Rk2 is the R 2 of the regression of Xk on the other p − 2
predictors in the regression and a constant.
• TOL can vary between 0 and 1;
• TOL close to 1 means that R k 2 is close to 0, indicating that
Xk is not highly correlated with the other predictors in the
model
• TOL close to 0 means that X k is highly correlated with the
other predictors; one then says that X k is collinear with the
other predictors
• A common rule of thumb is that TOL < 0.1 is an indication
that collinearity may unduly influence the results.
Variance Inflation Factor