## data consists of 4 psychological tests on men (m) and women (w) ## y1 = pictorial inconsistencies, y2 = paper form board, y3 = tool recognition, y4 = vocabulary # sample size n.m <- 32 n.w <- 32 # sample means y.bar.m <- matrix(c(15.97, 15.91, 27.19, 22.75),4,1) y.bar.w <- matrix(c(12.34, 13.91, 16.66, 21.94),4,1) # sample covariances S.m <- matrix(c(5.192, 4.545, 6.522, 5.250, 4.545, 13.18, 6.760, 6.266, 6.522, 6.760, 28.67, 14.47, 5.250, 6.266, 14.47, 16.65),4,4) S.w <- matrix(c(9.136, 7.549, 4.864, 4.151, 7.549, 18.60, 10.22, 5.446, 4.864, 10.22, 30.04, 13.49, 4.151, 5.446, 13.49, 28.00),4,4) # pooled covariance S.pooled <- ((n.m-1)*S.m+(n.w-1)*S.w)/(n.m+n.w-2) ## calculate mles from the sample estimators S.m.mle <- ((n.m-1)/n.m)*S.m S.w.mle <- ((n.w-1)/n.w)*S.w S.pooled.mle <- ((n.m+n.w-2)/(n.m+n.w))*S.pooled # conduct the likelhood ratio test LL.test.obs <- -2*((n.m/2)*log(det(S.m.mle)) + (n.w/2)*log(det(S.w.mle)) - ((n.m+n.w)/2)*log(det(S.pooled.mle)) ) LL.test.obs # in this test we are estimating 10 additional paramters from the constrained likelihood # with n1, n2 equal to 32 we will use the asymptotic result qchisq(0.95, 10) # do we accept or reject the null hypothesis of equal covariances?