Topic 29: Three-Way ANOVA. Outline Three-way ANOVA –Data –Model –Inference.

Slides:



Advertisements
Similar presentations
Topic 12: Multiple Linear Regression
Advertisements

Topic 32: Two-Way Mixed Effects Model. Outline Two-way mixed models Three-way mixed models.
Topic 12 – Further Topics in ANOVA
CHAPTER 25: One-Way Analysis of Variance Comparing Several Means
Topic 15: General Linear Tests and Extra Sum of Squares.
Copyright ©2006 Brooks/Cole, a division of Thomson Learning, Inc. Analysis of Variance Chapter 16.
Topic 3: Simple Linear Regression. Outline Simple linear regression model –Model parameters –Distribution of error terms Estimation of regression parameters.
Multi-Factor Studies Stat 701 Lecture E. Pena.
Two-Way ANOVA in SAS Multiple regression with two or
Incomplete Block Designs
Two-Way Balanced Independent Samples ANOVA Overview of Computations.
Two-Way Balanced Independent Samples ANOVA Computations Contrasts Confidence Intervals.
1 Topic 11 – ANOVA II Balanced Two-Way ANOVA (Chapter 19)
Understanding the Two-Way Analysis of Variance
Statistical Techniques I EXST7005 Factorial Treatments & Interactions.
Topic 16: Multicollinearity and Polynomial Regression.
Topic 28: Unequal Replication in Two-Way ANOVA. Outline Two-way ANOVA with unequal numbers of observations in the cells –Data and model –Regression approach.
1 Experimental Statistics - week 7 Chapter 15: Factorial Models (15.5) Chapter 17: Random Effects Models.
1 Experimental Statistics - week 6 Chapter 15: Randomized Complete Block Design (15.3) Factorial Models (15.5)
More complicated ANOVA models: two-way and repeated measures Chapter 12 Zar Chapter 11 Sokal & Rohlf First, remember your ANOVA basics……….
23-1 Analysis of Covariance (Chapter 16) A procedure for comparing treatment means that incorporates information on a quantitative explanatory variable,
Topic 7: Analysis of Variance. Outline Partitioning sums of squares Breakdown degrees of freedom Expected mean squares (EMS) F test ANOVA table General.
Lecture 4 SIMPLE LINEAR REGRESSION.
 The idea of ANOVA  Comparing several means  The problem of multiple comparisons  The ANOVA F test 1.
Topic 14: Inference in Multiple Regression. Outline Review multiple linear regression Inference of regression coefficients –Application to book example.
1 Experimental Statistics - week 10 Chapter 11: Linear Regression and Correlation Note: Homework Due Thursday.
STA305 week21 The One-Factor Model Statistical model is used to describe data. It is an equation that shows the dependence of the response variable upon.
GENERAL LINEAR MODELS Oneway ANOVA, GLM Univariate (n-way ANOVA, ANCOVA)
Randomized Block Design (Kirk, chapter 7) BUSI 6480 Lecture 6.
5-5 Inference on the Ratio of Variances of Two Normal Populations The F Distribution We wish to test the hypotheses: The development of a test procedure.
Two-Way Balanced Independent Samples ANOVA Computations.
Lab 5 instruction.  a collection of statistical methods to compare several groups according to their means on a quantitative response variable  Two-Way.
Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable.
STA305 week 51 Two-Factor Fixed Effects Model The model usually used for this design includes effects for both factors A and B. In addition, it includes.
The Completely Randomized Design (§8.3)
Topic 6: Estimation and Prediction of Y h. Outline Estimation and inference of E(Y h ) Prediction of a new observation Construction of a confidence band.
Topic 13: Multiple Linear Regression Example. Outline Description of example Descriptive summaries Investigation of various models Conclusions.
Hormone Example: nknw892.sas Y = change in growth rate after treatment Factor A = gender (male, female) Factor B = bone development level (severely depressed,
Topic 23: Diagnostics and Remedies. Outline Diagnostics –residual checks ANOVA remedial measures.
1 Experimental Statistics - week 14 Multiple Regression – miscellaneous topics.
Topic 30: Random Effects. Outline One-way random effects model –Data –Model –Inference.
Topic 25: Inference for Two-Way ANOVA. Outline Two-way ANOVA –Data, models, parameter estimates ANOVA table, EMS Analytical strategies Regression approach.
Bread Example: nknw817.sas Y = number of cases of bread sold (sales) Factor A = height of shelf display (bottom, middle, top) Factor B = width of shelf.
Topic 26: Analysis of Covariance. Outline One-way analysis of covariance –Data –Model –Inference –Diagnostics and rememdies Multifactor analysis of covariance.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
PSYC 3030 Review Session April 19, Housekeeping Exam: –April 26, 2004 (Monday) –RN 203 –Use pencil, bring calculator & eraser –Make use of your.
By: Corey T. Williams 03 May Situation Objective.
ANOVA: Graphical. Cereal Example: nknw677.sas Y = number of cases of cereal sold (CASES) X = design of the cereal package (PKGDES) r = 4 (there were 4.
Assignment 1 February 15, 2008Slides by Mark Hancock.
1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures.
Topic 24: Two-Way ANOVA. Outline Two-way ANOVA –Data –Cell means model –Parameter estimates –Factor effects model.
Topic 20: Single Factor Analysis of Variance. Outline Analysis of Variance –One set of treatments (i.e., single factor) Cell means model Factor effects.
Chapter 4 Analysis of Variance
One-Way Analysis of Variance Recapitulation Recapitulation 1. Comparing differences among three or more subsamples requires a different statistical test.
Example 1 (knnl917.sas) Y = months survival Treatment (3 levels)
The Mixed Effects Model - Introduction In many situations, one of the factors of interest will have its levels chosen because they are of specific interest.
Interview Example: nknw964.sas Y = rating of a job applicant Factor A represents 5 different personnel officers (interviewers) n = 4.
Topic 27: Strategies of Analysis. Outline Strategy for analysis of two-way studies –Interaction is not significant –Interaction is significant What if.
Topic 22: Inference. Outline Review One-way ANOVA Inference for means Differences in cell means Contrasts.
Topic 21: ANOVA and Linear Regression. Outline Review cell means and factor effects models Relationship between factor effects constraint and explanatory.
ANOVA and Multiple Comparison Tests
1 Topic 14 – Experimental Design Crossover Nested Factors Repeated Measures.
1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures.
1 Experimental Statistics - week 12 Chapter 11: Linear Regression and Correlation Chapter 12: Multiple Regression.
Factorial BG ANOVA Psy 420 Ainsworth. Topics in Factorial Designs Factorial? Crossing and Nesting Assumptions Analysis Traditional and Regression Approaches.
Two way ANOVA with replication
Two way ANOVA with replication
Topic 31: Two-way Random Effects Models
Experimental Statistics - week 8
Exercise 1 Use Transform  Compute variable to calculate weight lost by each person Calculate the overall mean weight lost Calculate the means and standard.
Presentation transcript:

Topic 29: Three-Way ANOVA

Outline Three-way ANOVA –Data –Model –Inference

Data for three-way ANOVA Y, the response variable Factor A with levels i = 1 to a Factor B with levels j = 1 to b Factor C with levels k = 1 to c Y ijkl is the l th observation in cell (i,j,k), l = 1 to n ijk A balanced design has n ijk =n

KNNL Example KNNL p 1005 Y is exercise tolerance, minutes until fatigue on a bicycle test A is gender, a=2 levels: male, female B is percent body fat, b=2 levels: high, low C is smoking history, c=2 levels: light, heavy n=3 persons aged per (i,j,k) cell

Read and check the data data a1; infile 'c:\...\CH24TA04.txt'; input extol gender fat smoke; proc print data=a1; run;

Obs extol gender fat smoke

Define variable for a plot data a1; set a1; if (gender eq 1)*(fat eq 1)*(smoke eq 1) then gfs='1_Mfs'; if (gender eq 1)*(fat eq 2)*(smoke eq 1) then gfs='2_MFs'; if (gender eq 1)*(fat eq 1)*(smoke eq 2) then gfs='3_MfS'; if (gender eq 1)*(fat eq 2)*(smoke eq 2) then gfs='4_MFS'; if (gender eq 2)*(fat eq 1)*(smoke eq 1) then gfs='5_Ffs'; if (gender eq 2)*(fat eq 2)*(smoke eq 1) then gfs='6_FFs'; if (gender eq 2)*(fat eq 1)*(smoke eq 2) then gfs='7_FfS'; if (gender eq 2)*(fat eq 2)*(smoke eq 2) then gfs='8_FFS'; run;

Obs extol gender fat smoke gfs _Mfs _Mfs _Mfs _MfS _MfS _MfS _MFs _MFs _MFs _MFS _MFS _MFS

Plot the data title1 'Plot of the data'; symbol1 v=circle i=none c=black; proc gplot data=a1; plot extol*gfs/frame; run;

Find the means proc sort data=a1; by gender fat smoke; proc means data=a1; output out=a2 mean=avextol; by gender fat smoke;

Define fat*smoke data a2; set a2; if (fat eq 1)*(smoke eq 1) then fs='1_fs'; if (fat eq 1)*(smoke eq 2) then fs='2_fS'; if (fat eq 2)*(smoke eq 1) then fs='3_Fs'; if (fat eq 2)*(smoke eq 2) then fs='4_FS';

Obs gen fat smoke FR avextol fs _fs _fs _fS _fS _Fs _Fs _FS _FS

Plot the means proc sort data=a2; by fs; title1 'Plot of the means'; symbol1 v='M' i=join c=black; symbol2 v='F' i=join c=black; proc gplot data=a2; plot avextol*fs=gender/frame; run;

Cell means model Y ijkl = μ ijk + ε ijkl –where μ ijk is the theoretical mean or expected value of all observations in cell (i,j,k) –the ε ijkl are iid N(0, σ 2 ) –Y ijkl ~ N(μ ijk, σ 2 ), independent

Estimates Estimate μ ijk by the mean of the observations in cell (i,j,k), = (Σ k Y ijkl )/n ijk For each (i,j,k) combination, we can get an estimate of the variance We need to combine these to get an estimate of σ 2

Pooled estimate of σ 2 We pool the s ijk 2, giving weights proportional to the df, n ijk -1 The pooled estimate is MSE=s 2 = (Σ (n ijk -1)s ijk 2 ) / (Σ(n ijk -1))

Factor effects model Model cell mean as μ ijk = μ + α i + β j + γ k + (αβ) ij + (αγ) ik + (βγ) jk + (αβγ) ijk μ is the overall mean α i, β j, γ k are the main effects of A, B, and C (αβ) ij, (αγ) ik, and (βγ) jk are the two-way interactions (first-order interactions) (αβγ) ijk is the three-way interaction (second-order interaction) Extension of the usual constraints apply

ANOVA table Sources of model variation are the three main effects, the three two-way interactions, and the one three-way interaction With balanced data the SS and DF add to the model SS and DF Still have Model + Error = Total Each effect is tested by an F statistic with MSE in the denominator

Run proc glm proc glm data=a1; class gender fat smoke; model extol=gender fat smoke gender*fat gender*smoke fat*smoke gender*fat*smoke; means gender*fat*smoke; run;

Run proc glm proc glm data=a1; class gender fat smoke; model extol=gender|fat|smoke; means gender*fat*smoke; run; Shorthand way to express model

SAS Parameter Estimates Solution option on the model statement gives parameter estimates for the glm parameterization These are as we have seen before; any main effect or interaction with a subscript of a, b, or c is zero These reproduce the cell means in the usual way

ANOVA Table SourceDF Sum of SquaresMean SquareF ValuePr > F Model Error Corrected Total Type I and III SS the same here

Factor effects output Source DF Type I SSMean SquareF ValuePr > F gender fat gender*fat smoke gender*smoke fat*smoke gender*fat*smoke

Analytical Strategy First examine interactions…highest order to lowest order Some options when one or more interactions are significant –Interpret the plot of means –Run analyses for each level of one factor, eg run A*B by C (lsmeans with slice option) –Run as a one-way with abc levels –Define a composite factor by combining two factors, eg AB with ab levels –Use contrasts

Analytical Strategy Some options when no interactions are significant –Use a multiple comparison procedure for the main effects –Use contrasts –When needed, rerun without the interactions

Example Interpretation Since there appears to be a fat by smoke interaction, let’s run a two-way ANOVA (no interaction) using the fat*smoke variable Note that we could also use the interaction plot to describe the interaction

Run glm proc glm data=a1; class gender fs; model extol=gender fs; means gender fs/tukey; run;

ANOVA Table SourceDF Sum of SquaresMean SquareF ValuePr > F Model <.0001 Error Corrected Total

Factor effects output SourceDFType I SS Mean SquareF ValuePr > F gender fs <.0001 Both are significant as expected…compare means

Means for gender Mean N gender A B

Tukey comparisons for fs Mean N fs A _fs B _fS B B _FS B B _Fs

Conclusions Gender difference with males having a roughly 5.5 minute higher exercise tolerance – beneficial to add CI here There was a smoking history by body fat level interaction where those who were low body fat and had a light smoking history had a significantly higher exercise tolerance than the other three groups

Last slide Read NKNW Chapter 24 We used program topic29.sas to generate the output for today