Other hypotheses of interest (cont’d) • In addition to the simple null hypothesis of no treatment effects, we might wish to test other hypothesis of the general form (examples follow): H0 : Ck×g βg×p = 0, Comparisons among treatments H0 : βg×pMp×q = 0, Comparisons across traits H0 : Ck×g βg×pMp×q = 0, A combination of both. • For example, suppose that we measure p = 2 traits on each unit in g = 3 treatment groups, and we set τ30 = [τ31 τ32]0 = 0. In this case, µ1 µ2 β = τ11 τ12 τ21 τ22 389 Other hypotheses of interest (cont’d) • Comparisons of treatment means: " Cβ = 0 1 0 0 1 −1 # # " µ1 µ2 τ11 τ12 . = τ τ 11 12 τ11 − τ21 τ12 − τ22 τ21 τ22 • Under the restriction τ13 = τ23 = 0, the first row of β is the expected value of units in treatment 3. • First row of C provides differences between mean resposnes for treatments 3 and 1 for both traits. • Second row of C provides differences between mean responses for treatments 1 and 2 for both traits. 390 Other hypotheses of interest (cont’d) • Comparison of trait means with each treatment group: µ1 µ2 βM = τ11 τ12 τ21 τ22 " 1 −1 # µ1 − µ2 = τ11 − τ12 . τ21 − τ22 • The first row compares mean responses for trait 1 and trait 2 for units receiving treatment 3. • The second row compares mean responses for trait 1 and trait 2 for units receiving treatment 1. • The third row compares mean responses for trait 1 and trait 2 for units receiving treatment 2. 391 Other hypotheses of interest (cont’d) • One might be interested in comparing the effects of the treatments on just the first trait: " CβM = 0 1 0 0 1 −1 # " # µ1 µ2 " # τ11 1 = . τ11 τ12 0 τ11 − τ21 τ21 τ22 • Row 1 is the difference of the effects of treatments 3 and 1 on mean responses for trait 1. • Row 2 is the difference of the effect of treatments 1 and 2 on mean responses for trait 1. 392 Other hypotheses of interest (cont’d) • One might be interested in interaction contrasts : " CβM = 0 1 0 0 1 −1 # # " # µ1 µ2 " 1 τ11 − τ21 = . τ τ 11 12 −1 (τ11 − τ21) − (τ12 − τ22) τ21 τ22 • The first is the difference in mean responses to treatments 3 and 1 for trait 1 minus the difference in mean responses to treatments 3 and 1 for trait 2. • The second is the difference in mean responses to treatments 1 and 2 for trait 1 minus the difference in mean responses to treatments 1 and 2 for trait 2. 393 F approximation to the sampling distribution of Wilk’s Criterion C. R. Rao (1951) Bulletin Int. Stat. Inst. 33(2), 177-180. • Coincides with exact F-distribution for cases described on a previous slide • More accurate than large sample chi-square approximation • Similar F-approximations are used by SAS for Pillai’s trace and the Lawley-Hotelling trace. 394 F approximation to the sampling distribution of Wilk’s Criterion • When H0 : Ck×r βr×pMp×u = 0k×u is true 1 − Λ1/b ab − c ∼ F(ku,ab−c) 1/b uk Λ where a = (n − r) − (u − k + 1)/2 v u u u2k 2 − 4 b = t 2 u + k2 − 5 c = (uk − 2)/2 395 Example: One-way MANOVA • Populations: g = 3 types of students – (k = 1) Technical school students (n1 = 23) – (k = 2) Architecture students (n2 = 38) – (k = 3) Medical technology students (n3 = 21) • Response variables: p = 4 test scores – aptitude test – mathematics test – language test – general knowledge 396 Example (cont’d) One-way MANOVA model Xij = Xij1 Xij2 Xij3 Xij4 = µ1 µ2 µ3 µ4 + τi1 τi2 τi3 τi4 + ij1 ij2 ij3 ij4 where ij = ij1 ij2 ij3 ij4 ∼ N ID(0, Σ) and use the SAS constraints τ31 = τ32 = τ33 = τ34 = 0 397 Example (cont’d) • Test the null hypothesis that the mean vectors for the four traits are the same for all three types of students • Write the one-way MANOVA model in matrix form Xn×p = An×r βr×p + n×p where µ1 µ2 µ3 µ4 β3×4 = τ11 τ12 τ13 τ14 τ21 τ22 τ23 τ24 398 Example (cont’d) The null hypothesis that the mean vectors for the four traits are the same for all three types of students can be written as " H0 : Cβ = 0 1 0 0 0 1 # " # µ1 µ2 µ3 µ4 0 0 0 0 = τ τ τ τ 11 12 13 14 0 0 0 0 τ21 τ22 τ23 τ24 Here k = 2 rows in C r = 3 rows in β p = 4 response variables M = I4×4 so u = p = 4 n = n1 + n2 + n3 = 23 + 38 + 21 = 82 399 Example (cont’d) |W | The value of Wilks Lambda is |B+W | = 0.544 a = (82 − 3) − (4 − 2 + 1)/2 = 77.5 v u u 4222 − 4 b = t 2 =2 2 4 +2 −5 c = ((4)(2) − 2)/2 = 3 and F = √ ! 1− Λ ab − c √ = 6.76 uk Λ on (uk, ab−c) = (8, 152) degrees of freedom and p-value < .0001 Conclude that the means scores are different for at least two types of students for at least one the the four response variables 400 Example (Cont’d) • Can test the null hypothesis of equal response means across populations by running a one way ANOVA for each of the four response variables. • SAS code (in morel.sas) PROC GLM DATA=SET1; CLASS GROUP; MODEL X1-X4 = GROUP / Solution; MANOVA H=group /PRINTH PRINTE; RUN; 401 Example (Cont’d) MANOVA Test Criteria and F Approximations for the Hypothesis of No Overall group Effect H = Type III SSCP Matrix for group E = Error SSCP Matrix S=2 Statistic Wilks’ Lambda Pillai’s Trace Hotelling-Lawley Trace Roy’s Greatest Root M=0.5 Value 0.543448 0.492698 0.773588 0.675059 N=37 F Value 6.77 6.29 7.29 12.99 Num DF 8 8 8 4 Den DF 152 154 106.27 77 p-value <.0001 <.0001 <.0001 NOTE: F Statistic for Roy’s Greatest Root is an upper bound. NOTE: F Statistic for Wilks’ Lambda is exact. 402 Example (Cont’d): morel.R > morel[,1] <- as.factor(morel[,1]) > fit <- manova(as.matrix(morel[,-1])~morel[,1]) > summary(fit, test="Wilks") Df Wilks approx F num Df den Df Pr(>F) morel[, 1] 2 0.54345 6.7736 8 152 1.384e-07 *** Residuals 79 --Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 > summary(fit, test="Pillai") Df Pillai approx F num Df den Df Pr(>F) morel[, 1] 2 0.4927 6.2923 8 154 4.824e-07 *** Residuals 79 --403 Bonferroni t-tests and intervals • Can also examine Bonferroni simultaneous t-tests and CIs • For the difference in treatment means for the i-th response (µi + τki) − (µi + τ`i) = τki − τ`i, we need the variance of X̄ki = X̄`i: ! Var(τ̂ki − τ̂`i) = Var(X̄ki − X̄`i) = 1 1 + σii, nk n` wii where σii is estimated as spooled,ii = n−g , with wii the ith diagonal element of the within-groups SSP matrix W . 404 Bonferroni t-tests and intervals • If we wish to carry out all pairwise comparisons, there will be pg(g − 1)/2 of them. • To maintain a simultaneous type I error level of no more than α we can use tn−g ( α ) 2m where m= pg(g − 1) . 2 • Reject H0 : τki = τ`i if t = r |X̄ki = X̄`i| 1 + 1 s pooled,ii nk n` > tn−g ( α ) 2m 405 Bonferroni simultaneous intervals • We have three groups and four variables, for a total of 4×3×2/2 = 12 comparisons, three for each response variable. • From the output: w11 = 55036.1955 w33 = 4759.8655 w22 = 14588.9983 w44 = 7040.6248 with n1 = 23, n2 = 37, n3 = 20 and n − g = 82 − 3 = 79. 406 Bonferroni simultaneous intervals • A 95% confidence interval for the true difference between technical school and architecture students on mathematics is v u α u w22 t x̄12 − x̄22 ± tn−g ( ) 2m n−g s 1 1 + n1 n2 ! 14588.9983 1 1 47.3913 − 51.1842 ± t79(0.05/24) + 79 23 37 √ −3.7929 ± 2.951 184.671 × 0.0705 ⇒ (−14.441, 6.855). Since the interval includes 0, we conclude that there is insufficient evidence to reject the null hypothesis of equal mathematics means scores for technical and architecture students. 407 Bonferroni simultaneous intervals • We carry out similar calculations for other types of students. Compare technical school to medical technology students: v u α u w x̄12 − x̄32 ± tn−g ( )t 22 2m n−g s 1 1 + n1 n2 ! 14588.9983 1 1 + 47.3913 − 38.0952 ± t79(0.05/24) 79 23 20 √ 9.296 ± 2.951 184.671 × 0.09348 ⇒ (−2.965, 21.577). 408 Bonferroni simultaneous intervals • Architecture versus medical technology students: v u w α u )t 22 x̄22 − x̄32 ± tn−g ( 1 1 + n1 n2 ! 2m n−g √ 13.089 ± 2.951 184.671 × 0.0713 ⇒ (2.381, 23.797). • Repeat these calculations for each of the other three response variables to construct 12 confidence intervals with simultaneous 95% confidence. 409 Test for Parallel Profiles • Are the differences in mean scores for each pair of tests consistent across all 3 student groups? • Are the differences in mean scores between two student groups consistent across all response variables? • Parallel profiles are equivalent to no group × test interaction 410 Test for Parallel Profiles • The no group × test interaction null hypothesis is expressed as [(µ1 + τ11) − (µ2 + τ12)] − [µ1 − µ2] = 0 [(µ2 + τ12) − (µ3 + τ13)] − [µ2 − µ3] = 0 [(µ3 + τ13) − (µ4 + τ14)] − [µ3 − µ4] = 0 [(µ1 + τ21) − (µ2 + τ22)] − [µ1 − µ2] = 0 [(µ2 + τ22) − (µ3 + τ23)] − [µ2 − µ3] = 0 [(µ3 + τ23) − (µ4 + τ24)] − [µ3 − µ4] = 0 411 Test for Parallel Profiles • This is equivalent to H0 : Ck×r βr×pMp×u " = " = 0 1 0 0 0 1 # 0 0 0 0 0 0 # 1 0 0 µ1 µ2 µ3 µ4 1 0 −1 τ11 τ12 τ13 τ14 0 −1 1 τ21 τ22 τ23 τ24 0 0 −1 where k = 2 rows in C r = 3 rows in β p = 4 response variables u=3 n = n1 + n2 + n3 = 23 + 38 + 21 = 82 412 Test for Parallel Profiles |W | The value of Wilks Lambda is |B+W | = 0.569 a = (82 − 3) − (3 − 2 + 1)/2 = 78 v u u 3222 − 4 b = t 2 =2 3 + 22 − 5 c = ((3)(2) − 2)/2 = 2 √ ! 1− Λ ab − c √ F = = 8.36 uk Λ on (uk, ab−c) = (6, 154) degrees of freedom and p-value < .0001 Conclude that the mean score profiles are not parallel. For at least one pair of response variables, the difference in the mean responses is not the same for all types of students. 413 Testing for parallel profiles using R > M <- matrix(c(1, 0, 0, -1, 1, 0, 0, -1, 1, 0, 0, -1), ncol = 4) > fitp <- manova((as.matrix(morel[, -1]) %*% t(M)) ~ morel[, 1]) > summary(fitp, test="Wilks") Df Wilks approx F num Df den Df Pr(>F) morel[, 1] 2 0.5689 8.3624 6 154 7.461e-08 *** Residuals 79 --Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 414 MANOVA Using the (preferred) car package > morel$studentgroup <- as.factor(morel$studentgroup) > library(car) > fit.lm <- lm(cbind(aptitude, mathematics, language, generalknowledge)~studentgroup , data = morel) > fit.manova <- Manova(fit.lm) > summary(fit.manova) Type II MANOVA Tests: Sum of squares and products for error: aptitude mathematics language generalknowledge aptitude 55036.195 8140.0376 5569.9774 5490.1278 mathematics 8140.038 14588.9983 2619.2097 -128.0217 language 5569.977 2619.2097 4759.8655 -102.4044 generalknowledge 5490.128 -128.0217 -102.4044 7040.6248 415 Term: studentgroup Sum of squares and products for the hypothesis: aptitude mathematics language generalknowledge aptitude 24600.207 6832.584 5709.5104 -2040.4327 mathematics 6832.584 2329.599 1570.1805 -1064.7222 language 5709.510 1570.181 1325.6955 -455.5712 generalknowledge -2040.433 -1064.722 -455.5712 743.4849 Multivariate Tests: Df Pillai 2 Wilks 2 Hotelling-Lawley 2 Roy 2 studentgroup test stat approx F num Df den Df Pr(>F) 0.4926982 6.292329 8 154 4.8238e-07 *** 0.5434483 6.773565 8 152 1.3843e-07 *** 0.7735884 7.252392 8 150 4.0901e-08 *** 0.6750591 12.994889 4 77 3.9151e-08 *** 416 > fit$SSPE aptitude mathematics language generalknowledge aptitude 55036.195 8140.0376 5569.9774 5490.1278 mathematics 8140.038 14588.9983 2619.2097 -128.0217 language 5569.977 2619.2097 4759.8655 -102.4044 generalknowledge 5490.128 -128.0217 -102.4044 7040.6248 > C <- matrix(c(0, 1, 0, 0, 1, -1), ncol = 3, by = T) > M <- matrix(c(1, 0, 0, -1, 1, 0, 0, -1, 1, 0, 0, -1), nrow = 4, by = T) > newfit <- linearHypothesis(model = fit.lm, hypothesis.matrix = C) > print(newfit) Multivariate Tests: Df test stat approx F num Df den Df Pr(>F) Pillai 2 0.4926982 6.292329 8 154 4.8238e-07 *** Wilks 2 0.5434483 6.773565 8 152 1.3843e-07 *** Hotelling-Lawley 2 0.7735884 7.252392 8 150 4.0901e-08 *** Roy 2 0.6750591 12.994889 4 77 3.9151e-08 *** 417 > newfit <- linearHypothesis(model = fit.lm, hypothesis.matrix = C, P = M) > print(newfit) Response transformation matrix: [,1] [,2] [,3] aptitude 1 0 0 mathematics -1 1 0 language 0 -1 1 generalknowledge 0 0 -1 418 Sum of squares and products for the hypothesis: [,1] [,2] [,3] [1,] 13264.6375 363.6553 5115.040 [2,] 363.6553 514.9337 853.636 [3,] 5115.0403 853.6360 2980.323 Sum of squares and products for error: [,1] [,2] [,3] [1,] 53345.119 -9399.728 -2667.382 [2,] -9399.728 14110.444 -2115.038 [3,] -2667.382 -2115.038 12005.299 Multivariate Tests: Df test stat approx F num Df den Df Pillai 2 0.4539686 7.634505 6 156 Wilks 2 0.5689034 8.362413 6 154 Hotelling-Lawley 2 0.7175639 9.089142 6 152 Roy 2 0.6563063 17.063963 3 78 Pr(>F) 3.3709e-07 7.4605e-08 1.7098e-08 1.2962e-08 419 *** *** *** ***