ancova a hybrid of regression and analysis of variance
TRANSCRIPT
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
ijiijiiij XXAY )(
ijiijCiij XXAY )(
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!!
0
10
20
30
40
50
60
0 2 4 6 8 10 12
T1
T2
T3
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)
www.ebme.co.uk/arts/aps/pic1a.gif
'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.
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
10.05 0.312 14.44 -0.112 17.17 -0.355 22.28 -0.403X
Membrane potential for four different cation systems
-40
-30
-20
-10
0
10
20
30
40
50
60
-2 -1.5 -1 -0.5 0 0.5 1
log activity ratio
me
an
me
mb
ran
e p
ote
ntia
l (in
mV
) Ca-Li
Ca-Na
Ca-K
Sr-Na
Linear (Sr-Na)
Linear (Ca-Na)
Linear (Ca-K)
Linear (Ca-Li)
Component Ca-Li Ca-Na Ca-K Sr-Na Pooled Within
(sum)
311.33 1096.97 2180.13 2034.63 5623.06
0.727 2.461 4.703 4.639 12.53
15.02 51.85 100.63 96.80 264.30
20.66 21.07 21.39 20.87
22 )(1
i
n
i YYy
For each group compute the following:
22 )(1
i
n
i XXx
))((1
YYXXxy ii
n
i
1b 09.21withinb
Component Ca-Li Ca-Na Ca-K Sr-Na Pooled(sum)
310.43 1092.43 2152.84 2020.02 5575.73
0.898 4.54 27.29 14.60 47.33
22 )ˆ(ˆ1
i
n
i YYy
For each group compute the following:
2)ˆ(1
i
n
i YY
93.557453.12
)30.274(
)(
)))(((
ˆ2
2
2
2
1
1
i
n
i
ii
n
i
within
XX
YYXX
y 13.4893.557406.56232_ withinYXd
33.4773.557506.56232 YXd
79.033.4713.48'_ sbamongSS
46.242)()(1
YYXXnxy i
n a
iitotal
85.2130.26445.2421
within
n
totalamong xyxyxy
We obtain amongxy
71.1816006.14
)57.242(72.6013
)( 2
2
222
_
1
total
totaln
totaltotalYX x
xyyd
We calculate unexplained sums of squares for these two levels of variation:
309.6748.1
)84.21(65.390
)( 2
2
222
_
1
among
amongn
amongamongYX x
xyyd
111
65.39006.562372.6013222n
within
n
total
n
among yyy
6.1768129.4871.18162_
22)( withinYXYXtotaladjYX ddd
We test the null hypothesis that there are no differences among sample means when these are adjusted for a common and a common regression line:
Y X
53.5983
56.1768
1_
2)(
_
a
dsquareMean adjYX
meansadjusted
008.316
1.48
1_
2)(
a
i
withinYXerror
an
dsquareMean
98.195008.3
53.598
_
_ _ within
meansadjusteds squaremean
squaremeanF
Sokal and Rohlf, 2000. Biometry
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
The output of R: