Download presentation
Presentation is loading. Please wait.
Published byAmy Todd Modified over 8 years ago
1
Topic 21: ANOVA and Linear Regression
2
Outline Review cell means and factor effects models Relationship between factor effects constraint and explanatory variables
3
Cell Means Model Y ij = μ i + ε ij –where μ i is the theoretical mean or expected value of all observations at level i –The ε ij are iid N(0, σ 2 ) –Y ij ~N(μ i, σ 2 ), independent
4
Factor Effects Model A reparameterization of the cell means model Useful way at looking at more complicated models Null hypotheses are easier to state Y ij = μ + i + ε ij –the ε ij are iid N(0, σ 2 )
5
Parameters The cell means model has r+1 parameters – r μ’s and σ 2 The factor effects model has r+2 parameters – μ, the r ’s, and σ 2 Build restriction on ’s in factor effects model to remove one degree of freedom (e.g., Σ i i = 0 or r = 0)
6
Regression Approach We can use multiple regression to reproduce the results based on the factor effects model Y ij = μ + i + ij and we will restrict Σ i i = 0
7
Coding for Explanatory Variables Σ i i = 0 implies r = - 1 - 2 -…- r-1 Due to restriction, i = 1 to r-1 columns X ij = 1 if Y is observation from level i = -1 if Y is observation at level r = 0 if Y is from any other level
8
KNNL Example Recall KNNL p 687 from Topic 20 It is a bit messy because n i = 5, 5, 4, 5 The grand mean is not necessarily the same as the mean of the group means (i.e., μ = (Σ i n i μ i )/n T ) We will calculate these two values You will have an easier example in the homework (n i is constant) where they are the same value
9
Means proc means data=a1 noprint; class design; var cases; output out=a2 mean=mclass; run; proc print data=a2; run;
10
Output Obs des _TYPE_ _FREQ_ mclass 1. 0 19 18.6316 2 1 1 5 14.6000 3 2 1 5 13.4000 4 3 1 4 19.5000 5 4 1 5 27.2000 Grand sample mean…not the average of the four trt sample means shown below it
11
The mean of the means proc means data=a2 mean; where _TYPE_ eq 1; var mclass; run;
12
Output The MEANS Procedure Analysis Variable : mclass Mean ƒƒƒƒƒƒƒƒƒƒƒƒ 18.6750000 ƒƒƒƒƒƒƒƒƒƒƒƒ Not a big difference from grand sample mean in this example
13
Generate explanatory variables for REG data a1; set a1; x1=(design eq 1)-(design eq 4); x2=(design eq 2)-(design eq 4); x3=(design eq 3)-(design eq 4); proc print data=a1; run;
14
Output Obs cases design x1 x2 x3 1 11 1 1 0 0 6 12 2 0 1 0 11 23 3 0 0 1 15 27 4 -1 -1 -1
15
Output with parameters des x1 x2 x3 1 1 0 0 μ + 1 2 0 1 0 μ + 2 3 0 0 1 μ + 3 4 -1 -1 -1 μ - 1 - 2 - 3 is the result of including an intercept
16
Run the regression proc reg data=a1; model cases=x1 x2 x3; run;
17
Output Anova Source DF SS MS F P Model 3 588 196 18.59 <.0001 Error 15 158 10 Total 18 746 Same ANOVA table as GLM
18
Regression coefficients Var Est Int 18.675 mean of the means x1 -4.075 Y 1./n 1 - Int x2 -5.275 Y 2./n 2 - Int x3 0.825 Y 3./n 3 - Int 18.675-4.075 = 14.6 18.675-5.275 = 13.4 18.675+0.825 = 19.5 18.675+4.075+5.275-0.825=27.2 Get same trt means
19
Last slide Read KNNL Chapter 16 We used program topic21.sas to generate the output for today
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.