Hi there,
I'm trying to do multivariate ANOVA and have a bit trouble with the
following code:
<hansl>
nulldata 8
matrix Y={9,4;10,2;11,0;2,3;4,4;6,5;1,5;5,9}
matrix G={1;1;1;2;2;2;3;3}
matrix T=mcov(Y)*(rows(Y)-1)
eval T
matrix Ns =zeros(rows(uniq(G)),1)
#How to get to the Sum of squared residuals?
matrix Y_g1=Y[1:3,]
matrix Y_g2=Y[4:6,]
matrix Y_g3=Y[7:8,]
matrix C={}
matrix C1=mcov(Y_g1)*(rows(Y_g1)-1)
matrix C2=mcov(Y_g2)*(rows(Y_g2)-1)
matrix C3=mcov(Y_g3)*(rows(Y_g3)-1)
matrix C=C1+C2+C3
eval C
matrix C={}
loop for g=1..rows(Ns)
#C+=mcov(Y_g$g)*(rows(Y_g$g)-1)
C+=C$g # this is not working
endloop
eval C
<hansl>
Up until now I did not find a way to get to know the number of obs
per group or the indices for the the matrices matrix Y_g*.
Should work with some loop construction. However, what do you thing
of giving the function cdemean a second argument that demeans the
columns
according to the structure of the groups as in G: C=cdemean(Y,G)'cdemean(Y,G)'
Cheers
Leon Unger