490 likes | 1.04k Views
Lecture 4 Oneway Analysis of Variance (ANOVA). One-way classification (Completely Randomised Design). What is it? Sources of variation (ANOVA) Tables of means and comparisons SAS Code OUTPUT – description & interpretation Treatment comparisons – planned & unplanned.
E N D
One-way classification(Completely Randomised Design) • What is it? • Sources of variation (ANOVA) • Tables of means and comparisons • SAS • Code • OUTPUT – description & interpretation • Treatment comparisons – planned & unplanned
Completely Randomised Designs (CRD) - compare the mean response for a specified set of treatments • The response will be measured on a number of experimental units • Units will be allocated at random to the treatments • The design is balanced if an equal number of units is allocated to each treatment Any observed effect is either: produced by the treatments due to an unlikely occurrence (say p < 0.05)
Example – what effects tenderness of cooked beans? 10 batches of beans allocated to each of 4 treatments: Cooking at (oC): 100, 110, 120 for 45 min, and 100 for 35 min
ANOVA – the idea SS(Total) = SS(Treatment) + SS(Residual)
ANOVA Is there evidence that mean tenderness depends on temperature/cooking time? F = 10.64, p < .0001Yes!
When is F with (3,36) DF large? F = 10.64 is in the top 0.01% (p < .0001)
Example A nutrition experiment is made with six treatments (diets) as follows Twenty lambs were assigned at random to each of the six diets and their weight daily gain (gd-1) from birth to 6 mo was recorded. Real treatment effects will present as differences between the 6 treatment means Even with no treatment effects these will differ, due to animal differences (background noise (BN)) BN be measured by the variation among animals on the same treatment, so we can see if differences between means exceeds that explained by BN
Statistical Information Summarized by • Analysis of variance (ANOVA) table • tests whether treatment means differ • provides an estimate of BN using s2 • Table of treatment means & SED • tests which pairs of means differ • tests for linear trends etc
Analysis of Variance (ANOVA) MS(Treatments) is nearly 7 times larger than what would be expected with no treatment effects The chance of such a large F-value (SAS: Pr > F) in this case isp = 0.00012 DFTreatments: 5 comparisons needed to compare 6 means Total: variation (around an estimated mean) among 120 values has 119 DF Residual: 119 – 5 = 114
DF – the idea Variation among n sample valuesaround an estimated mean has n – 1 DF Example:4 treatments with samples of sizes 10 15 10 20 DF(Total) = 55 – 1 = 54 DF(Treatment) = 4 – 1 = 3 (= no of comparisons) DF(variation in samples) = 9, 14, 9, 19 DF(Residual) = 9 + 14 + 9 + 19 = 51 Note: 51 + 3 = 54soResidual DF is what’s left over whenDF(Treatment) is subtracted from DF(Total)
Table of Treatment Means ANOVA table only answers general question: Do data provide evidence thatthe treatment means differ? We ask: which means differ from which? Evidence for this comes from samples(of equal size n) where: Difference in means >> SED = s√(2/n) From the ANOVA tables s = √MS(Residual)
Table of Means & SED– which treatments differ? e.g.(86.1 – 80.7)/2.87 = 1.88= t (Student’s t) so means 1 & 2 are 1.88 larger than a typical difference between means when treatments don’t in fact differ Is such a large difference likely? p = 0.12 (12%)
Comparing means – SAS/GLM output SED = (2MSE/r) = √(2 249.9 /10) = 7.07 Comparing means uses: t = Difference/SED DF = Error DFsince SED involves √MSE
GLM code to compare treatments procglmdata = bean; class treat; model tender = treat; lsmeans treat; estimate ‘1v2’ treat 1 -1 0 0; run; quit;
Comparing means procglmdata = bean; class treat; model tender = treat; estimate ‘1v3’ treat 1 0 -1 0; estimate ‘ ’ treat ; estimate ‘ ’ treat ; run;
Comparing means – What comparisons? procglmdata = bean; class treat; model tender = treat; estimate ‘1v3’ treat 1 0 -1 0; estimate ‘ ’ treat ; estimate ‘ ’ treat ; run;
Comparing means – What comparisons? procglmdata = bean; class treat; model tender = treat; estimate ‘1v3’ treat 1 0 -1 0; estimate ‘1v4’ treat 1 0 0 -1; run;
Comparing means – What comparisons? procglmdata = bean; class treat; model tender = treat; estimate ‘1v3’ treat 1 0 -1 0; estimate ‘1v4’ treat 1 0 0 -1; estimate ‘av(1&3)v2’ treat 1 -2 1 0; run;
Comparing means – What comparisons? ‘Dose-Response’ relationship
Comparing means – What comparisons? ‘Dose-Response’ relationship
Summary of useful GLM OUTPUT • Class Levels: note order of treatments • Fit Statistics: • R-squared: not of great relevance! • CV: check in range expected for experimental material • MEAN: check order of magnitude is reasonable • Overall ANOVA: • F & p (Pr > F): small p provides evidence of treatment differencesthis is a rough check, but not totally conclusive if p > 0.05 • MSE = s2 & DF • SS: • Type I (here get the same p value) • Type III ignore! • Least Squares Means:
Examining GLM OUTPUT • Continue data screening: Check for indications of errors orders of magnitude as expected e.g. • Check for statistically significant resultsBut: differences statistically significant, may not be practically significant (being real but too small e.g.) • Check differences are believable(confirm preconceived ideas) • Identify treatment comparisons of particular interest, and carry out appropriate tests
What to report • ANOVA tableTreatment means differed significantly(F = 10.64, p < .0001, DF = (3, 36)) • Table of means and SED or graph • Important comparisons: • Increasing temperature greatly increased tenderness(T1 vT3, p = .0004) • There was no evidence that the effect on cooking temperature was other than linear(T2 v average of T1 & T3, p = 0.65) • Decreasing cooking time reduced tenderness, but not significantly(T1 v T4, p = 0.15) • See PGRM pg 8-10
Example: Greenhouse experiment (PGRM pg 8-11) Nitrogen (mg N per pot) SED = 0.505 Mean yield (g/100cm2 pot)
ANOVA • Treatment effect highly significant (F = 12.27) • How much is due to a linear response to level of N? • Is a more complex model of response required? Need ANOVA which partitions variation intoLinear, non-linear & Error
Response models • When treatments are levels of a quantitative variable (e.g. Temperature, N, Moisture etc)
Response models • When treatments are levels of a quantitative variable (e.g. Temperature, N, Moisture etc)
Response models • When treatments are levels of a quantitative variable (e.g. Temperature, N, Moisture etc)
Response models • Theory may suggest the algebraic form required • Otherwise a low degree polynomial is desired • SS for treatment partitions into 1 df for linear 1 df for quadratic (extra effect) Remaining df – test for lack of fit.
Example 6 treatments20 lambs per treatment SED = 2.87 What comparisons should be tested?
Rounding: how much? PGRM 8-20 to 8-22 • For reporting means and SEDs a) Round the SED to three significant digits b) Round means to one less digit than the SED.
Rounding: how much? PGRM 8-20 to 8-22 • For reporting means and SEDs a) Round the SED to three significant digits b) Round means to one less digit than the SED. Rule based on rounding error being less than 1% of random error
Effect of too severe rounding on the t test for comparing two treatments.
Unplanned comparisonsPGRM pg 8-15 Sometimes there is no a priori rationale for picking certain comparisons to test. Examples: 1) In examining treatment means we notice a contrast that seems unexpectedly large but which we had not planned to test. 2) Four proprietary doughnut recipes are tested but their details are secret.
The problem – coincidence Many treatments implies many possible comparisons. The more we implicitly make the more likely to observe some significance. Protect against spurious significance
Case 2) Protected LSD test. (a) if the F test for the treatments is not significant then do not compare means (b) Otherwise use usual t to test comparisons of interest.
Bonferroni method: a defined number of unplanned tests (a) divide the significance level at which it is desired to work (0.05) by the number of tests (n) (b) use the t value for 0.05/n for all tests. (c) Observed t exceeding this level are significant at 0.05.