[R] ANOVA: Help with SSQ decomposition and contrasts
Jose Claudio Faria
joseclaudio.faria at terra.com.br
Tue Feb 14 01:35:47 CET 2006
# Dear R list,
#
# A have a doubt about SSQ decomposition and contrasts with ANOVAs.
# So, I would like a tip from more advanced R users.
# Below my data, the basic script and my doubts:
# Data
r = paste('r', gl(3, 8), sep='')
e = paste('e', rep(gl(2, 4), 3), sep='')
tra = sort(paste('t', rep(1:6, 4), sep=''))
y = c(26.2, 26.0, 25.0, 25.4, 24.8, 24.6, 26.7, 25.2,
25.7, 26.3, 25.1, 26.4, 19.6, 21.1, 19.0, 18.6,
22.8, 19.4, 18.8, 19.2, 19.8, 21.4, 22.8, 21.3)
dF = data.frame(r, e, tra, y)
# Graphic
par(mfrow=c(2,1))
interaction.plot(dF$r, dF$e, dF$y,
col = 'blue', ylab = 'Y', xlab = 'R')
interaction.plot(dF$e, dF$r, dF$y,
col = 'blue', ylab = 'Y', xlab = 'R')
# ANOVAs
av0 = aov(y ~ tra, data=dF)
summary(av0)
av1 = aov(y ~ r*e, data=dF)
summary(av1)
av2 = aov(y ~ r/e, data=dF)
e_r = summary(av2, split = list('r:e' = list(
'e1 vs e2/r1' = 1, 'e1 vs e2/r2' = 2, 'e1 vs e2/r3' = 3)))
e_r
av3 = aov(y ~ e/r, data=dF)
r_e = summary(av3, split = list('e:r' = list(
'r/e1' = c(1,3), 'r/e2' = c(2,4))))
r_e
# My Doubts
# a) How to make SSQ decomposition to complete the ANOVA below?
# Df Sum Sq Mean Sq F value Pr(>F)
# e 1 19.082 19.082 14.875 0.001155
# e:r 4 156.622 39.155 30.524 8.438e-08
# e:r: r/e1 2 87.122 43.561 33.958 7.776e-07
# r1 vs (r2, r3) 1 ? ? ? ?
# r2 vs r3 1 ? ? ? ?
# e:r: r/e2 2 69.500 34.750 27.090 3.730e-06
# r1 vs (r2, r3) 1 ? ? ? ?
# r2 vs r3 1 ? ? ? ?
# Residuals 18 23.090 1.283
# b) How to make SSQ decomposition to complete the ANOVA below?
# Df Sum Sq Mean Sq F value Pr(>F)
# e 1 19.082 19.082 14.875 0.001155
# e:r 4 156.622 39.155 30.524 8.438e-08
# e:r: r/e1 2 87.122 43.561 33.958 7.776e-07
# r2 vs (r1, r3) 1 ? ? ? ?
# r1 vs r3 1 ? ? ? ?
# e:r: r/e2 2 69.500 34.750 27.090 3.730e-06
# r2 vs (r1, r3) 1 ? ? ? ?
# r1 vs r3 1 ? ? ? ?
# Residuals 18 23.090 1.283
# TIA,
--
Jose Claudio Faria
Brasil/Bahia/UESC/DCET
Estatistica Experimental/Prof. Adjunto
mails:
joseclaudio.faria at terra.com.br
joseclaudio.faria at oi.com.br
jc_faria at uesc.br
jc_faria at uol.com.br
tel: 73-3634.2779
More information about the R-help
mailing list