[R] MANOVA

Jorge Magalhaes root at predict.telepac.pt
Thu Jul 20 22:58:28 CEST 2000


I tried to compute Wilks Lamdba with the following code.

cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

> metA<-read.table('./methodA.txt', header=T)
> metB<-read.table('./methodB.txt', header=T)
> metAbar<-apply(metA,2,mean)
> metBbar<-apply(metB,2,mean)
> metAcentred<-t(t(metA)-metAbar) # column centred Xij-xibar
> metBcentred<-t(t(metB)-metBbar) # column centred 
> WA<-crossprod(metAcentred) # compute W matrix 
> WB<-crossprod(metBcentred) # compute W matrix 
> Wt <- WA + WB
> met <- rbind(metA, metB) # all data in the same matrix
> metbar<-apply(met, 2, mean) # global mean vector
> BA <- nrow(metA) * (metAbar - metbar) %*% (t(metAbar)-t(metbar)) # compute B matrix  
> BB <- nrow(metB) * (metBbar - metbar) %*% (t(metBbar)-t(metbar)) # compute B matrix 
> Bt <- BA + BB
> lamdba <- det(Wt) / det(Bt+Wt) # Wilks Lamdba
> lamdba
[1] 0.4541112
> Wt.Bt.prod <- t(Wt) %*% Bt
> pillar <- eigen(Wt.Bt.prod)  # eigen for the Pillai test

ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

Somebody can comment this code?

Jorge


...........................................
The data:
 
"Method A (Sludge calcinated at 1100 C)"

methodA.txt
............................................
 Chromium	Nickel	Aluminum	Zinc
 2.0	3.0	2.7	2.3
 2.1	3.1	2.8	2.2
 1.9	3.2	2.6	2.3
 2.2	3.1	2.8	2.2
 ..........................................

"Method B (Sludge calcinated at 1500 C)"

methodB.txt
............................................  
 Chromium	Nickel	Aluminum	Zinc
 2.1	3.1	2.6	2.2
 2.3	2.9	3.0	2.5
 1.9	3.0	2.6	2.2
 2.2	3.0	2.9	2.1
 2.4	3.1	2.7	2.2
 2.3	3.0	2.6	2.1
 1.8	2.8	2.7	2.0
 ...........................................

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list