Vous êtes sur la page 1sur 21

ANCOVA

A hybrid of regression and


analysis of variance
Analysis of covariance
• It is an analysis of variance performed on
residuals from the regression of the
response variable on the covariate
Analysis of covariance

Yij    Ai   i ( X ij  X i )   ij

Yij    Ai   C ( X ij  X i )   ij
Plotting ANCOVAs
• The ANCOVA plot should use the
continuous covariate variable plotted on
the x-axis, and the Y variable plotted on
the y-axis. Each point represents an
independent replicate, and different
symbols or colors should be used for each
treatment group.
Plotting results
A B C

D E F
Match???
1. Treatment significant, covariate and interaction term
non-significant (C)
2. Treatment and covariate significant, interaction term
non-significant (D)
3. Interaction term significant, everything else non-
significant (E)
4. Covariate not significant, treatment, and interaction
significant (F)
5. Covariate significant, treatment and interaction non-
significant (B)
6. No term significant (A)
Dangerous data!!
60

50

40
T1
30 T2
T3
20

10

0
0 2 4 6 8 10 12
An important thing…
• In Analysis of Covariance order matters

• This model:
model <- lm(Y ~ X*Group)
• is not the same as this one
model <- lm(Y ~ Group*X)
Membrane potential (in millivolts)
'Action potential' is the name
given to the electrical nerve
impulse waveform that is
generated by the neuron (nerve
cell). The shape of an action
potential can be seen using an
amplifier circuit (voltage clamp)
as shown in the diagram below,
which measures the flow of ions
using two electrodes inserted into
the nerve fibre.

www.ebme.co.uk/arts/aps/pic1a.gif
Membrane potential (in millivolts)
• Yamauchi and Kimizuka (1971) measured membrane
potential for 4 different cation systems as a function of
the logarithm of the activity ratio of various electrolytes
are various concentrations. We wish to test whether the
mean membrane potential “Y” is different for these
systems
Data
a= 4 groups (cation systems)
Ca-Li Ca-Na Ca-K Sr-Na
Y X Y X Y X Y X
-2.4 -0.31 -7.0 -1.18 -10.8 -1.79 -5.4 -1.83
6.3 0.17 2.1 -0.65 -2.8 -1.21 3.0 -1.25
15.8 0.58 17.8 0.10 14.2 -0.35 20.7 -0.41
20.5 0.81 27.3 0.50 25.5 0.08 30.5 0.05
32.0 0.67 35.7 0.49 39.9 0.43
41.2 0.65 45.0 0.59
N 4 5 6 6
X 10.05 0.312 14.44 -0.112 17.17 -0.355 22.28 -0.403
Membrane potential for four
different cation systems
60 Ca-Li
mean membrane potential (in mV)

50 Ca-Na
40 Ca-K
Sr-Na
30
Linear (Sr-Na)
20
Linear (Ca-Na)
10 Linear (Ca-K)
0 Linear (Ca-Li)
-10
-20
-30
-40
-2 -1.5 -1 -0.5 0 0.5 1
log activity ratio
For each group compute the following:

Component Ca-Li Ca-Na Ca-K Sr-Na Pooled Within


(sum)
n1 311.33 1096.97 2180.13 2034.63 5623.06
 y  (Y  Y )
2
i i
2

n1 0.727 2.461 4.703 4.639 12.53


 x   ( X i  X i )2
2

n1 15.02 51.85 100.63 96.80 264.30


 xy  ( X i  X i )(Yi  Y )

b1 20.66 21.07 21.39 20.87


bwithin  21.09
For each group compute the following:

Component Ca-Li Ca-Na Ca-K Sr-Na Pooled(sum)


n1 310.43 1092.43 2152.84 2020.02 5575.73
 yˆ  (Yˆi  Yi ) 2
2

 d
n1
( ( X i  X i )(Yi  Y )) 2 2
2
YX 5623.06  5575.73  47.33
(274.30)
 yˆ   5574.93
d  5623.06  5574.93  48.13
2 2
within n1
12.53 YX _ within
 ( X i  X i ) 2 SS among _ b 's  48.13  47.33  0.79
n1
0.898 4.54 27.29 14.60 47.33
 (Yi  Yˆi ) 2
n1 a

 xy total   ni ( X i  X )(Yi  Y )  242.46


We obtain  xy among

n1

 xy among  xytotal   xywithin  242.45  264.30  21.85

We calculate unexplained sums of squares for these two levels of


variation:
n1
( xytotal ) 2 (242.57) 2
d 2
 y 2
  6013.72   1816.71
x
YX _ total total 2
total 14.006
n1 n1 n1

y 2
among   y 2 total   y 2 within  6013.72  5623.06  390.65

n1
( xyamong ) 2 (21.84) 2
d 2
 y 2
  390.65   67.309
x
YX _ among among 2
among 1.48
We test the null hypothesis that there are no differences among sample
means Y when these are adjusted for a common X and a common
regression line:

 YX (adj )  YXtotal  YX _ within  1816.71  48.129  1768.6


d 2
 d 2
 d 2

Mean _ square adjusted _ means 


 YX ( adj )
d 2


1768.56
 598.53
a 1 3

Mean _ squareerror 
 YX ( within)
d 2


48.1
 3.008
a
16
 n  a 1
i

mean _ square adjusted _ means 598.53


Fs    195.98
mean _ square within 3.008
Sokal and Rohlf, 2000. Biometry
The output of R:

Df Sum Sq Mean Sq F value Pr(>F)


X 1 4197.0 4197.0 1395.25 < 2.2e-16 ***
Group 3 1768.6 589.5 195.98 8.005e-13 ***
Residuals 16 48.1 3.0
When the rod shearing process at Stockton Steel is "in control" it produces rods with
a mean length of 120 inches. Periodically, quality control inspectors select a random
sample of 36 rods. If the mean length of sampled rods is too long or too short, the
shearing process is shut down. The last sample showed a mean of 120.5 inches.
Assume that the population standard deviation was 1.2 inches. Using alpha= 0.05,
the appropriate decision is _________.

H0: mu = 120
Ha: mu not equal to 120
 
z crit = +/- 1.96
 
z = (120.5-120)/(1.2/sqrt(36))
z = 2.5
 
That's too high, so we reject the null:
D. reject the null hypothesis and shut down the process

Vous aimerez peut-être aussi