8.10 part iii: You can use the "It can be shown" statement on page 215 to justify the chi-square part, and you can say that independence is assumed between terms in the ratio. -------------------------------------------------------------------------------------------------- 9.6 The X matrix is n x 2, so X'X is 2 x 2. Invert that matrix, and the question calls for the diagonal entries in that matrix. -------------------------------------------------------------------------------------------------- 9.15 parts a and b: An example very similar to this is examined on page 190. Be sure to at least briefly answer whether the various hypotheses are sensible. -------------------------------- an R coding hint: # this is the rowbasis matrix from page 205 rowbasis <- matrix(c(1,1,0,0, 1,0,1,0, 1,0,0,1, 1,-1,-1,-1),nrow=4,ncol=4,byrow=T) inrowbasis <- solve(rowbasis) 4*inrowbasis -------------------------------- a SAS coding hint: * this shows how the solution is obtained for the example on page 205 ; proc iml ; * The rowbasis matrix from page 205 ; rowbasis = { 1 1 0 0 , 1 0 1 0 , 1 0 0 1 , 1 -1 -1 -1 } ; invrowb = inv(rowbasis) ; invrowb2 = 4*invrowb ; print rowbasis ; print invrowb invrowb2 ; run ; part c: Use regression models with both dummy and deviation coding to generate the SS expressions. -------------------------------- an R coding hint: Moore1 <- read.table("c:/temp/moore.txt",header=F,skip=1) names(Moore1) <- c("partner","status","conformity","fcategory","fscore") # defining deviation-coded variables Moore1$stlowdev <- as.numeric(Moore1$status == "low") - as.numeric(Moore1$status == "high") Moore1$flowdev <- as.numeric(Moore1$fcategory == "low") - as.numeric(Moore1$fcategory == "high") Moore1$fmeddev <- as.numeric(Moore1$fcategory == "medium") - as.numeric(Moore1$fcategory == "high") # defining deviation-coded crossproduct variables used to test for interaction Moore1$stLfLdev <- Moore1$stlowdev*Moore1$flowdev Moore1$stLfMdev <- Moore1$stlowdev*Moore1$fmeddev # individual deviation-coded SSE terms from regression models SSEabc <- anova(lm(conformity ~ stlowdev +flowdev +fmeddev +stLfLdev +stLfMdev, data=Moore1 ) )$"Sum Sq"[6] SSEab <- anova(lm(conformity ~ stlowdev +flowdev +fmeddev , data=Moore1 ) )$"Sum Sq"[4] SSEac <- anova(lm(conformity ~ stlowdev +stLfLdev +stLfMdev, data=Moore1 ) )$"Sum Sq"[4] SSEbc <- anova(lm(conformity ~ flowdev +fmeddev +stLfLdev +stLfMdev, data=Moore1 ) )$"Sum Sq"[5] SSEa <- anova(lm(conformity ~ stlowdev , data=Moore1 ) )$"Sum Sq"[2] SSEb <- anova(lm(conformity ~ flowdev +fmeddev , data=Moore1 ) )$"Sum Sq"[3] SSEc <- anova(lm(conformity ~ stLfLdev +stLfMdev, data=Moore1 ) )$"Sum Sq"[3] print(c(SSEabc,SSEab,SSEac,SSEbc,SSEa,SSEb,SSEc)) Note: SS(alpha | beta) = SSReg(alpha, beta) - SSReg(beta) = SSError(beta) - SSError(alpha, beta) this is the effect of the A factor added to a model already containing factor B, up above we have SS(alpha | beta) = SSEb - SSEab = 212.21 (this is the Type II SS for factor A) the Anova function in the car() package calculates Type II SS -------------------------------- a SAS hint: data moore ; infile 'c:\temp\moore.txt' firstobs = 2 ; input partner status $ conformity fcategory $ fscore ; * here we define deviation-coded regressors, including interaction regressors ; statuslow = (status = 'low') ; if status = 'high' then statuslow = -1 ; fcategorylow = (fcategory = 'low') ; if fcategory = 'high' then fcategorylow = -1 ; fcategorymedium = (fcategory = 'medium') ; if fcategory = 'high' then fcategorymedium = -1 ; statlowfcatlow = statuslow*fcategorylow ; statlowfcatmed = statuslow*fcategorymedium ; title 'Moore and Krupat data, analysis from page 161'; run ; proc reg data = moore ; modelSSabc : model conformity = statuslow fcategorylow fcategorymedium statlowfcatlow statlowfcatmed ; modelSSab : model conformity = statuslow fcategorylow fcategorymedium ; modelSSac : model conformity = statuslow statlowfcatlow statlowfcatmed ; modelSSbc : model conformity = fcategorylow fcategorymedium statlowfcatlow statlowfcatmed ; modelSSa : model conformity = statuslow ; modelSSb : model conformity = fcategorylow fcategorymedium ; run ; * proc glm does these calculations for us ; proc glm data = moore ; class status fcategory ; model conformity = status fcategory status*fcategory / ss1 ss2 ss3 ; run ;