input s y1 y2 y3 y4 1 3 4 4 3 2 2 4 4 5 3 2 3 3 6 4 3 3 3 5 5 1 2 4 7 6 3 3 6 6 7 4 4 5 10 8 6 5 5 8 end
generate con = 1 manova y1 y2 y3 y4 = con, noconstant Number of obs = 8 W = Wilks' lambda L = Lawley-Hotelling trace P = Pillai's trace R = Roy's largest root Source | Statistic df F(df1, df2) = F Prob>F -----------+-------------------------------------------------- con | W 0.0196 1 4.0 4.0 49.92 0.0011 e | P 0.9804 4.0 4.0 49.92 0.0011 e | L 49.9217 4.0 4.0 49.92 0.0011 e | R 49.9217 4.0 4.0 49.92 0.0011 e |-------------------------------------------------- Residual | 7 -----------+-------------------------------------------------- Total | 8 -------------------------------------------------------------- e = exact, a = approximate, u = upper bound on F
mat ycomp = (1,0,0,-1\0,1,0,-1\0,0,1,-1) mat list ycomp ymat[3,4] c1 c2 c3 c4 r1 1 0 0 -1 r2 0 1 0 -1 r3 0 0 1 -1 manovatest con, ytrans(ycomp) Transformations of the dependent variables (1) y1 - y4 (2) y2 - y4 (3) y3 - y4 W = Wilks' lambda L = Lawley-Hotelling trace P = Pillai's trace R = Roy's largest root Source | Statistic df F(df1, df2) = F Prob>F -----------+-------------------------------------------------- con | W 0.2458 1 3.0 5.0 5.11 0.0554 e | P 0.7542 3.0 5.0 5.11 0.0554 e | L 3.0682 3.0 5.0 5.11 0.0554 e | R 3.0682 3.0 5.0 5.11 0.0554 e |-------------------------------------------------- Residual | 7 ---------------------------------------------------------
Example 2
input s a y1 y2 y3 y4 1 1 3 4 7 7 2 1 6 5 8 8 3 1 3 4 7 9 4 1 3 3 6 8 5 2 1 2 5 10 6 2 2 3 6 10 7 2 2 4 5 9 8 2 2 3 6 11 end
manova y1 y2 y3 y4 = a Number of obs = 8 W = Wilks' lambda L = Lawley-Hotelling trace P = Pillai's trace R = Roy's largest root Source | Statistic df F(df1, df2) = F Prob>F -----------+-------------------------------------------------- a | W 0.1374 1 4.0 3.0 4.71 0.1169 e | P 0.8626 4.0 3.0 4.71 0.1169 e | L 6.2764 4.0 3.0 4.71 0.1169 e | R 6.2764 4.0 3.0 4.71 0.1169 e |-------------------------------------------------- Residual | 6 -----------+-------------------------------------------------- Total | 7 -------------------------------------------------------------- e = exact, a = approximate, u = upper bound on
mat ymat = (1,0,0,-1\0,1,0,-1\0,0,1,-1) mat list ymat ymat[3,4] c1 c2 c3 c4 r1 1 0 0 -1 r2 0 1 0 -1 r3 0 0 1 -1 /* test of the a*y interaction */ manovatest a, ytransform(ymat) Transformations of the dependent variables (1) y1 - y4 (2) y2 - y4 (3) y3 - y4 W = Wilks' lambda L = Lawley-Hotelling trace P = Pillai's trace R = Roy's largest root Source | Statistic df F(df1, df2) = F Prob>F -----------+-------------------------------------------------- a | W 0.1443 1 3.0 4.0 7.91 0.0371 e | P 0.8557 3.0 4.0 7.91 0.0371 e | L 5.9296 3.0 4.0 7.91 0.0371 e | R 5.9296 3.0 4.0 7.91 0.0371 e |-------------------------------------------------- Residual | 6 -------------------------------------------------------------- e = exact, a = approximate, u = upper bound on F
/* test of y */ mat xmat = (1, .5, .5) mat list xmat xmat[1,3] c1 c2 c3 r1 1 .5 .5 manovatest, test(xmat) ytransform(ymat) Transformations of the dependent variables (1) y1 - y4 (2) y2 - y4 (3) y3 - y4 Test constraint (1) _cons + .5 a[1] + .5 a[2] = 0 W = Wilks' lambda L = Lawley-Hotelling trace P = Pillai's trace R = Roy's largest root Source | Statistic df F(df1, df2) = F Prob>F -----------+-------------------------------------------------- manovatest | W 0.0275 1 3.0 4.0 47.19 0.0014 e | P 0.9725 3.0 4.0 47.19 0.0014 e | L 35.3944 3.0 4.0 47.19 0.0014 e | R 35.3944 3.0 4.0 47.19 0.0014 e |-------------------------------------------------- Residual | 6 -------------------------------------------------------------