


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Stat 402A, HW 9 Answers
Parts are worth one point, except where marked otherwise.
data hyp; infile ’hyp.txt’; input block trt $ y;
proc glm; class trt block; model y = trt block; contrast ’trt’ trt 1 -1; title ’1a’; proc glm; model y = ; title ’1b’; proc glm; class trt; model y = trt; title ’1b’; proc glm; class block; model y = block; title ’1c’; proc glm; class trt block; model y = block trt;title ’1d’; run;
(a) The contrast SS = 0.708, the Type I SS = 0.568 and the type III SS = 0.708. (b) The error SS for the intercept only and treatment only models are 31.782 and 31.214. Hence, the trt SS = 31.782 - 31.214 = 0.568. This matches the type I SS from part a. (c) The error SS for the block only and blocks+treatments models are 8.273 and 7.565. Hence, the trt SS for this pair of models = 8.273 - 7.565 = 0.708. This matches the type III SS from part a. (d) 3 pts. The Type III SS are the same as in part a, but the type I are different. When the model is block trt, the type I and type III SS are the same because the same pair of models are being compared. When the model is trt block, the type I and type III are different because a) the SS is based on different pairs of models and b) the sample sizes are unequal. Note: In all cases, you are looking at the SS for treatments. The block SS are not relevant, except perhaps as part of the reduced model. If you struggled here, I suggest you review the “SS by model comparison” part of the 2 way factorial handout.
data alpine; infile ’alpine1.txt’ firstobs = 2; input expt $ spp $ site $ logbiom; %$ logbiom2 = logbiom; if logbiom =. then logbiom2 = 2; /* the above two statements create a new variable called logbiom2 / / with values of 2 instead of missing (.) */
/* logbiom is still the original variable with missing values / proc glm data=alpine; class spp site; model logbiom = spp site sppsite; lsmeans sppsite / slice = site; title ’2a and 2c (slicing)’; proc sort data=alpine; by spp site; proc means noprint; by spp site; var logbiom; output out=means mean=meanlbiom; proc plot; plot meanlbiomsite=spp; title ’2b: plot of cell means’; proc glm data=alpine; by spp; class site; model logbiom = site; lsmeans site; title ’2c: Separate analyses’; proc glm data = alpine; class spp site; model logbiom2 = spp site sppsite; lsmeans spp site; lsmeans sppsite / slice = spp; title ’2d: Analysis with dead replaced by small value’; run;
(a) 2 pts. 1) Averaged over the species, there is no evidence of a difference in yield between sites (F = 0.67, p = 0.52).
input place $ spp $ site $ lnwt; proc glm data = alpine2; class place spp site; model lnwt = place site spp sitespp placesite placespp placesitespp; / you could also use model lnwt = place | site | spp; */
(a) 2 pts. ANOVA table
Source d.f. Place 1 Site 2 Species 1 SiteSpecies 2 PlaceSite 2 PlaceSpecies 1 PlaceSiteSpecies 2 Error 108 Total 119 Notes: Site, species and their interaction have the same d.f. here as they did in the 1 place analysis (previous problem). Their interpretation is different; here they represent comparisons of averages of the two experiments. The entire treatment structure (2 places, 2 species, 3 sites) should account for a total of 223 - 1 d.f. If it doesn’t, you’re either missing something or double counting something. (b) 1 pt. PlaceSpecies and Placespeciessite The first tests whether the simple effect of species (i.e. the difference between species) is the same in all places. The second tests whether the interaction between species and sites are equal in the two places. (c) 1 pt. None of the interactions involving place are significant at p < 0 .05, so there is no evidence of different effects (either of sites or speciessite interactions) at the two places. Specifically, for placesites: F = 0.39, p =0.68 and for placesitespecies: F = 0.29, p = 0.75. Notice that this part asks about sites but the previous part asked about species. You need to look at different lines in the ANOVA table. (d) 1 pt. Yes, there are missing observations. Two things indicate this: The corrected total d.f. is 108, smaller than the 119 that you would expect, or the contrasts defining each effect are not orthogonal, so the Type I SS differ from the Type III SS. (e) 1 pt. No, there are no missing cells. The three way interaction has 2 d.f., which is what you would expect: 2 x 1 x 1 = 2.