2ReviewRecall the idea of confounding. Suppose I want to draw inference about a certain predictor.If meaningfully different interpretations would be made depending on whether a nuisance variable is included in the model, we say that the predictor of interest is confounded with the nuisance variable. (Both will be significant – if not it is collinearity instead.)In order to draw correct conclusions, the nuisance variable must be included in the model.
3DefinitionsWe considered confounding for continuous predictors of interest, but it can certainly occur for categorical factors as well.We have different names for confounding depending on the situation:A (necessary) nuisance variable that is continuous is generally called a covariate.If it is another categorical factor, we usually refer to it as a blocking variable.
4InteractionIn either case, we make an assumption that the nuisance variable does not interact with the predictor of interest.If there were interaction, then we have a more complicated interaction model and BOTH variables must become variables of equal interest. This becomes either Two-Way ANOVA or Multiple Regression.For now, assume no interaction.
5The Big Picture The nuisance variable does one of two things: Its inclusion MAY change our perspective in the sense that the pattern of differences (pairwise comparisons) for the factor of interest will change.Alternatively, its inclusion may simply be necessary to reduce the MSE so that we can actually see differences.
6Key to Understanding View ANCOVA and Blocking as one and the same. In both situations, we are removing variation due to a nuisance variable.We are also “adjusting” the response variable for the nuisance variable – and then will compare the ADJUSTED treatment means (which may differ from the actual treatment means). Comparisons of the unadjusted means could be inaccurate.
7Examples We now consider a couple of examples. In both examples, we will consider the effect of three standard treatments for a certain cancer.All patients are started on their respective treatment at the same time.The response variable is the lifetime of the patient in months after beginning treatment.
12The missing piece? Each person is not at the same stage of disease. Some of them may have developed the cancer only recently, while others have had it for a long time.What does the picture look like if we consider this?
18ImportanceFailure to adjust for the covariate in either of these examples that we have seen would be a big mistake (and clearly in this case the cost would be quite high).In Example I, we’d choose what is in fact the worst treatment.In Example II, we’d fail to differentiate between the treatments when in fact one of them is clearly better than the rest.
19One-Factor ANOVA with one (or more) continuous covariate(s). ANCOVAOne-Factor ANOVA with one (or more) continuous covariate(s).
20ANCOVA Model (Cell Means) Usual assumptions / Can use factor effects instead. One additional assumption: NO INTERACTION.Could (roughly) think of “adjusting first” and modeling:
21ANCOVA Model (2)Making the adjustment first would require knowing the true value of beta. Since we can’t know this, we essentially use the estimate of beta to make the adjustment and then compare means (SAS: LSMEANS).The adjustment effectively “levels the playing field” so that the comparison of means is made with all observations on equal footing (in the above case to X = X_bar).
22ANCOVA Model (3)It is somewhat important to understand how SAS works (with LSMeans).Instead of using X=0 as the standard, SAS uses X-bar. So all of the means are compared at X = X-bar. This means that the adjusted means (for SAS) will be:
23Mathematical DetailYou don’t necessarily need to understand all of the mathematics behind the adjustment. (If you are interested, feel free to see me outside of class.)But it is very important to understand...WHEN and WHY an adjustment is needed.HOW to get the adjusted means in SAS and compare them.THAT using a MEANS statement is 100% WRONG any time there is a covariate involved.
24Analysis ProcedureCheck assumptions as usual. Check interaction assumption by doing an “interaction plot” (more later).Check significance of variables (covariate listed first in model) using Type I SS (added in order). Marginally significant covariates should be included.Do pairwise comparisons for your factor using LSMEANS statement.
25Details: Interaction Plot Plot the response versus the covariate with different lines representing the different levels of the factor.Judge whether the lines are mostly parallel.Can also add an interaction term to the model (costs an additional a – 1 DF) and check for its significance.
29Example IAssumption of “no interaction” seems reasonable – proceed with the ANCOVA model analysis.Might try producing these plots for the second example on your own.
30Details: LSMeansAn LSMeans statement in SAS is used to obtain and compare the “adjusted” factor level means.The syntax of the LSMeans statement is similar to the Means statement (which as we know will produce incorrect results).We can still use pairwise comparison procedures on the adjusted means (or look at contrasts of the adjusted means, etc).
31Options in LSMeans Options come after “/” as usual. ADJUST = <...> can be used to adjust critical values to BON, DUNNETT, SCHEFFE, or TUKEY (default is T – no adjustment)ALPHA = 0.xxx can be used to set the significance levelCL calls for confidence limits for the individual means. If used in conjunction with PDIFF, it also produces confidence limits for differences.
32Options in LSMeans (2)OUT = <datasetname> produces an output dataset that contains the “adjusted” means and their standard errors. This can be useful if you want to set up a contrast.PDIFF requests the p-values for pairwise comparisons (the format in which they appear is slightly different than for the means statement)STDERR requests the standard errors.TDIFF requests the t-values for pairwise differences (similar information to PDIFF)
36InterpretationsAfter Tukey adjustment is made, we don’t find significant differences when we look at pairwise comparisons.We’d still tend toward Treatment 3 – thinking that we may simply be lacking in power. (If we used LSD, we would see Treatment 3 as being better). Another experiment would be necessary to confirm this (but possibly unethical in this case – why???).
37Other ObservationsAlthough the cell sizes were equal, the standard errors are not the same. Why?The standard errors will also involve the X’s. Recall that standard errors for mean responses increase as one gets further away from X-bar.It happened in this case that the X’s for observations that received treatment 2 were closer to X-bar. This means that the adjusted treatment mean for that group will have a smaller standard error than the other group.
38CLG Activity #1 Question #10.1 relates to Example II Question #10.2 gives you the chance to analyze another example.
39Randomized Complete Blocks Two-way ANOVA where one factor is important to us while the other is simply a nuisance factor.
40Two-way ANOVA (Briefly) Interested in a combination of two factors (e.g. diet + exercise program on blood pressure).Factor Effects model used to distinguish effects:Could treat each combination of factors as a treatment and do two-way ANOVA
41Two-way ANOVA (Briefly) The “Betas” in this model are effects, not slope estimates. Be careful not to get confused!Key to avoid confusion: If the beta is written in the model with a subscript ‘j’, then it is a factor effect. If on the other hand it does not have such a subscript and is multiplied by an ‘X’, then it is a slope parameter for the continuous variable X.
42InteractionThe term represents the potential interaction between the two factors.For now, we will still be assuming “no interaction” as we discuss blocking.We will go into interactions in greater detail in the next topic when we talk about Two-way ANOVA in general.
43Randomized Complete Block Design RCBD is used when...We have one factor of interest in studying our response variable.We have another nuisance factor that has an effect on the response variable, but the effect is not of interest. It is important that we have some experimental control with regard to the nuisance factor.
44RandomizationIf levels of nuisance variable cannot be measured / controlled, then the best we can do is to use one-way ANOVA and make sure to randomize the treatments to the experiment units. Why is such a randomization important?If the levels of the nuisance variable can be observed (but not controlled), we may be able to use stratified sampling to obtain a RCBD.
45RCBDIn a randomized complete block design, we set things up as follows:Each treatment is applied to one experimental unit within each block (or sometimes more than once if the design is replicated, but we almost always try to keep the design balanced).The treatments are randomized within the blocks.
46Design ChartsOften use a “design chart” to illustrate the experimental design.List factors in rows and columns, use “x” to represent a data point that will be collected.Helps to determine degrees of freedom for treatments, interactions, etc.
47Design Chart ExampleGoal: Determine whether grade level has an effect on the length of time a teacher will stay in the professionIn each of 15 major cities, one teacher from each grade level 1 through 8 was followed from the beginning of their career.This yields 120 observations; city is a blocking variable.
50Back to RCBD…In a blocking design we generally use only one replicate. So we wind up with:b blocks each consisting of a experimental units (EU’s), for a total of N = ab observations.The treatments are randomly assigned to EU’s within a block (so not totally randomized – but stratified in such a way that each block contains each treatment once).
51Recall: Paired T TestsBlocking is essentially an extension of the paired T-test (instead of pairs, we now have blocks containing enough EU’s to apply each of the treatments within a block).Remember the point of pairing was that we improve precision by removing explainable variation from the analysis. The same thing occurs when we block – we remove variation due to the blocks first and then analyze our treatments.The similarities of blocking to ANCOVA are also quite clear. Both methods (if correctly applied) reduce the MSE and give more precision.
52Statistical Model for RCBD Assume we have b blocks & a treatmentsIn addition to typical assumptions, we assume that the effect due to the blocking variable is additive (i.e. there is no interaction between block and treatment).Reminder: Betas are (re)used for the block effects - they are NOT slope parameters.
54Model Restrictions Common parameter restrictions are (makes the model unique and the grand mean)SAS of course uses something a little different, setting
55ANOVA Table for RCBD Source df SS MS F0 Block SSBLK MSBLK Treatment SSTRTMSTRTErrorSSERRMSERRTotalSSTOTMSTOT
56Breakdown of SSWhen the design is balanced, Type I and Type III SS will be the same. And they will add up to the model SS.So we can obtain an “extended” ANOVA table by combining the two pieces of SAS output (ANOVA Table with model line replaced by Type I SS).There are calculation formulas in the text – I’m not going to require you to worry about them.
57Tests Overall F test Testing for Block / Treatment Effects Null Hypothesis is that all ALPHAS and BETAS are zero.Rejection means something is significant, but we won’t know which factor is involved.Testing for Block / Treatment EffectsModel SS can be separated into two components. For a balanced design, it won’t matter whether you are using Type I or III (they’ll be the same).
58Tests (2)Test for “block” effect isn’t really important to us – but we can use the Type I or III SS to get an F statistic and testIf “block” is even marginally significant, it should be left in the model for the reduction in MSE.Pairwise comparisons are irrelevant (why?)
59Tests (3)Test for “treatment” is important, and we may similarly use the Type I or III SS to get an F statistic and testIf the treatment tests significant then we would want to do pairwise comparisons using LSMeans.Note: It IS actually ok to use MEANS for a balanced RCBD. But it might be simpler for you to just use LSMeans all the time.
60RCBD Multiple Comparisons Similar procedures as one-way ANOVA (Tukey, Scheffe, etc.)n is replaced by b in all formulasDegrees of freedom error isUse comparison procedure that is appropriate to what you are testing.
61Example: Problem (1)A study has been designed to compare body sizes of three genotypes of silkworm. Measurements include mean lengths for separately reared cocoons of heterozygous (HET), homozygous (HOM), and wild (WLD) silkworms. There were five laboratory sites and one of each type was measured at each site.VarSite #1Site #2Site #3Site #4Site #5HET29.8728.1632.0830.8429.44HOM32.5130.8234.1733.4632.99WLD35.7633.1436.2934.9535.89
62Example: Problem 18.7 (2) Is a randomized block analysis appropriate? Need to be able to assume that the blocks (SITE) do not interact with the treatment (TYPE).Not necessarily true – would need to consult with a scientist to determine whether the different “climates” would affect the various silkworm varieties differently. If so, then we should have an interaction model, not an RCBD. For the purposes of illustration we will assume it’s true but try to check our assumption.
65CommentsType tests as important (it turns out that it would even if we failed to block, but the blocks do remove some variation).Additivity assumption appears to be met.We proceed to analyze differences using LSMeans.