Partial answers to assignment 4

/* code fragment */

scalar n1=rowsof(X1)
scalar n2=rowsof(X2)
scalar n3=rowsof(X3)

mat u1=J(n1,1,1)
mat u2=J(n2,1,1)
mat u3=J(n3,1,1)

/* mv stands for mean vector */
mat mv1 = 1/n1*u1'*X1
mat mv2 = 1/n2*u2'*X2
mat mv3 = 1/n3*u3'*X3

/* mm stands for mean matrix */
mat mm1=u1*mv1
mat mm2=u2*mv2
mat mm3=u3*mv3

/* ds stands for deviation score matrix */
mat ds1=X1-mm1
mat ds2=X2-mm2
mat ds3=X3-mm3

/* sscp stands for the deviation sums of squares and cross products */
mat sscp1=ds1'*ds1
mat sscp2=ds2'*ds2
mat sscp3=ds3'*ds3

/* results */

mv1[1,3]
           c1         c2         c3
c1  18.118182  6.1909091  8.6818182

mv2[1,3]
           c1         c2         c3
c1  15.527273  5.5818182  5.1090909

mv3[1,3]
           c1         c2         c3
c1  15.345455  5.3727273  5.6363636

symmetric sscp1[3,3]
            c1          c2          c3
c1   152.39636
c2   28.431818   36.089091
c3  -141.76636  -11.071818   236.49636

symmetric sscp2[3,3]
            c1          c2          c3
c1   43.081818
c2  -12.929545   59.256364
c3  -17.252727   19.641818   64.069091

symmetric sscp3[3,3]
            c1          c2          c3
c1   98.487273
c2  -8.9513636   30.941818
c3  -48.758182   25.615909   125.80545

/* other results */

symmetric t[3,3]
            c1          c2          c3
c1    346.8897
c2   20.794848   130.26242
c3  -143.22576   50.897121   508.20061

symmetric w[3,3]
            c1          c2          c3
c1   293.96545
c2   6.5509091   126.28727
c3  -207.77727   34.185909   426.37091

symmetric b[3,3]
           c1         c2         c3
c1  52.924242
c2  14.243939  3.9751515
c3  64.551515  16.711212  81.829697

Wilk's Lambda = .52578837

F-ratio = 3.5382298

df1 = 6

df2 = 56

omega-squared.m = .43159482