Manova
Manova
Example 6.1
compare three different types of apple trees
– X1: circumference
– X2: height
ex6.1<-read.csv("./data/Example6-1.csv")
head(ex6.1) ] types
## type X1 X2 SSFSSDTSSE
## 1 1 11.1 2.57 SST SSE
SSB =
-
## 2 1 11.9 2.93
## 3 1 10.9 2.87
## 4 1 12.5 3.84
## 5 1 11.1 3.03
W ✓
eric -
ae
## 6 1 10.8 2.34 a-
-
µ →
n<-nrow(ex6.1)
n1<-sum(ex6.1$type==1); S1<-var(ex6.1[ex6.1$type==1,-1])
n2<-sum(ex6.1$type==2); S2<-var(ex6.1[ex6.1$type==2,-1])
n3<-sum(ex6.1$type==3); S3<-var(ex6.1[ex6.1$type==3,-1])
SST- Tot .
/ v. eine -
T<-(n-1)*var(ex6.1[,-1]) →
E<-(n1-1)*S1+(n2-1)*S2+(n3-1)*S3 → SSE
B<-T-E
nehm
ich
det(E)/det(B+E)
→
Ins
on
In -
ma
-
,
## [1] 0.9034644 se
EE ,
(
test.manova<-manova(cbind(X1,X2)~factor(type),data=ex6.1)
summary(test.manova,test=c("Wilks"))
summary(test.manova,test=c("Wilks"))
summary(test.manova,test=c("Pillai"))
summary(test.manova,test=c("Hotelling-Lawley"))
## [1] 0.1060861
summary(test.manova,test=c("Roy"))
⇒ c- -
nat rejct H .
Example 6.6
2*4 factorial design, repeated 4 times
– factor 1: rotational speed (A1,A2)
– factor 2: lubricant (B1, B2, B3, B4)
– variables
X1: force
X2: tension
ex6.6<-read.csv("./data/Example6-6.csv")
head(ex6.6) 4 Hr s -
t.ms z ,
-
## rotation lubricant X1 X2
## 1 A1 B1 7.80 90.4
## 2 A1 B1 7.10 88.9
## 3 A1 B1 7.89 85.9 h
## 4 A1 B1 7.82 88.8 mini .
Jo
-
## 5 A2 B1 7.12 85.1
/
-
a now
## 6 A2 B1 7.06 89.0
Xn
summary(aov(X1~rotation+lubricant+rotation*lubricant,data=ex6.6))
rot .li
## Df Sum Sq Mean Sq F value Pr(>F)
diftrace
.
: - ,
## rotation 1 1.205 1.2051 5.907 0.0229 * -
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 •
Xe
summary(aov(X2~rotation+lubricant+rotation*lubricant,data=ex6.6)) / for
##
## rotation
Df Sum Sq Mean Sq F value
1 614.3
Pr(>F)
614.3 20.019 0.000158 ***
- tot . tdfkrnm
##
##
lubricant 3
rotation:lubricant 3
74.9
32.2
25.0
10.7
0.813 0.499018
0.350 0.789277
:
~
rotation
## Residuals 24 736.4 30.7
## ---
o V -
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
M
.
n
ex6.6.manova<-manova(cbind(X1,X2)~rotation+lubricant+rotation*lubricant,data = e
\ x6.6) - -
summary(ex6.6.manova,test=c("Wilks"))
##
## rotation
Df Wilks approx F num Df den Df
1 0.47396 12.7636 2 23
Pr(>F)
0.0001867 ***
→ dfhn
## lubricant 3 0.69158 1.5524 6 46 0.1827862
## rotation:lubricant 3 0.93193 0.2751 6 46 0.9458304
## Residuals 24
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(ex6.6.manova,test=c("Pillai"))
-
summary(ex6.6.manova,test=c("Hotelling")) → -
se des & dz
## Df Hotelling-Lawley approx F num Df den Df Pr(>F)
## rotation 1 1.10988 12.7636 2 23 0.0001867 ***
## lubricant 3 0.43775 1.6051 6 44 0.1684454
## rotation:lubricant 3 0.07256 0.2660 6 44 0.9498087
## Residuals 24
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Example 6.7
Three groups of rabbits were injected with tuberculosis bacteria to obtain relevant data on
the growth of tuberculosis bacteria according to their physical condition.
– Three groups
G1: control group
G2:New Vaccination function degradation group
G3: Metabolic active group
– variables
X1: TB cirrhosis number
ß
PS
X2: TB size.
-
o
ex6.7<-read.csv("./data/Example6-7.csv") g-
]
§ ]
head(ex6.7)
## group X1 X2
µ JU
## 1 G1 24.0 3.5
§
## 2 G1 13.0 3.5 - -
Ms
Nsu
## 3 G1 12.2 4.0
=
Ho
Ms
## 4 G1 14.0 4.0
## 5 G1 22.2 3.6 : .
agil
!
"
## 6 G1 16.1 4.3
" t Hihi "
:
.
## one-way ANOVA
## X1
X1.anova<-aov(X1~group,data = ex6.7)
summary(X1.anova)
TukeyHSD(X1.anova)
⇒
⑤ ⑤
## X2
X2.anova<-aov(X2~group,data = ex6.7)
summary(X2.anova)
TukeyHSD(X2.anova)
}
## X1 X2
## 18.485714 4.014286
var(ex6.7[ex6.7$group=="G1",-1])
## X1 X2
## X1 38.041429 1.5135714
## X2 1.513571 0.3647619
Er
colMeans(ex6.7[ex6.7$group=="G2",-1])
## X1 X2
## 8.757143 2.642857
var(ex6.7[ex6.7$group=="G2",-1])
## X1 X2
## X1 7.2795238 0.9321429
## X2 0.9321429 0.4761905
93
}
colMeans(ex6.7[ex6.7$group=="G3",-1])
## X1 X2
## 33.78 2.36
var(ex6.7[ex6.7$group=="G3",-1])
## X1 X2
-0
## X1 212.412 -9.001 ; -
stand of ni - L - -
it
µ
## X2 -9.001 0.413 groß
library(ggplot2)
ggplot(ex6.7,aes(X1,X2,color=group))+geom_text(aes(label=group))
↳ ⇒
s .
5h53
.
-
~ c -
go.rs
\
Me - or -
## one-way MANOVA
fit<-manova(cbind(X1,X2)~group,data = ex6.7)
summary(fit,test="Wilks")
summary(fit,test="Pillai")
summary(fit,test="Roy")
summary(fit,test="Hotelling")
Ho :
M .
=
MEN ]
t Ho
Hi
'
n .
Ho
=3 reject