Title: Topic 30: Random Effects
1Topic 30 Random Effects
2Outline
- One-way random effects model
- Data
- Model
- Inference
3Data for one-way random effects model
- Y, the response variable
- Factor with levels i 1 to r
- Yij is the jth observation in cell i, j 1 to ni
- Almost identical model structure to earlier
one-way ANOVA. - Difference in level of inference
4Level of Inference
- In one-way ANOVA, interest was in comparing the
factor level means - In random effects scenario, interest is in the
pop of factor level means, not just the means of
the r study levels - Need to make assumptions about population
distribution - Will take random draw from pop of factor levels
for use in study
5KNNL Example
- KNNL p 1036
- Y is the rating of a job applicant
- Factor A represents five different personnel
interviewers (officers), r5 - n4 different applicants were interviewed by each
officer - The interviewers were selected at random and the
applicants were randomly assigned to interviewers
6Read and check the data
data a1 infile 'c\...\CH25TA01.DAT' input
rating officer proc print dataa1 run
7The data
Obs rating officer 1 76 1
2 65 1 3 85 1 4
74 1 5 59 2 6 75
2 7 81 2 8 67
2 9 49 3 10 63 3
8The data
Obs rating officer 11 61 3
12 46 3 13 74 4 14
71 4 15 85 4 16 89
4 17 66 5 18 84
5 19 80 5 20 79 5
9Plot the data
title1 'Plot of the data' symbol1 vcircle
inone cblack proc gplot dataa1 plot
ratingofficer/frame run
10(No Transcript)
11Find and plot the means
proc means dataa1 output outa2
meanavrate var rating by officer title1
'Plot of the means' symbol1 vcircle ijoin
cblack proc gplot dataa2 plot
avrateofficer/frame run
12(No Transcript)
13Random effects model
- Yij µi eij
- the µi are iid N(µ, sµ2)
- the eij are iid N(0, s2)
- µi and eij are independent
- Yij N(µ, sµ2 s2)
- Two sources of variation
- Observations with the same i are not
independent, covariance is sµ2
Key difference
14Random effects model
- This model is also called
- Model II ANOVA
- A variance components model
- The components of variance are sµ2 and s2
- The models that we previously studied are called
fixed effects models
15Random factor effects model
- Yij µ ?i eij
- ?i N(0, sµ2)
- eij N(0, s2)
- Yij N(µ, sµ2 s2)
16Parameters
- There are three parameters in these models
- µ
- sµ2
- s2
- The cell means (or factor levels) are random
variables, not parameters - Inference focuses on these variances
17Primary Hypothesis
- Want to know if H0 sµ2 0
- This implies all mi in model are equal but also
all mi not selected for analysis are also equal.
- Thus scope is broader than fixed effects case
- Need the factor levels of the study to be
representative of the population
18Alternative Hypothesis
- We are sometimes interested in estimating sµ2
/(sµ2 s2) - This is the same as sµ2 /sY2
- In some applications it is called the intraclass
correlation coefficient - It is the correlation between two observations
with the same I - Also percent of total variation of Y
19ANOVA table
- The terms and layout of the anova table are the
same as what we used for the fixed effects model - The expected mean squares (EMS) are different
because of the additional random effects but F
test statistics are the same - Be wary that hypotheses being tested are different
20EMS and parameter estimates
- E(MSA) s2 nsµ2
- E(MSE) s2
- We use MSE to estimate s2
- Can use (MSA MSE)/n to estimate sµ2
- Question Why might it we want an alternative
estimate for sµ2?
21Main Hypotheses
- H0 sµ2 0
- H1 sµ2 ? 0
- Test statistic is F MSA/MSE with r-1 and r(n-1)
degrees of freedom, reject when F is large,
report the P-value
22Run proc glm
proc glm dataa1 class officer model
ratingofficer random officer/test run
23Model and error output
Source DF MS F P Model 4 394 5.39
0.0068 Error 15 73 Total 19
24Random statement output
Source Type III Expected MS officer
Var(Error) 4 Var(officer)
25Proc varcomp
proc varcomp dataa1 class officer model
ratingofficer run
26Output
MIVQUE(0) Estimates Variance Component
rating Var(officer) 80.41042 Var(Error)
73.28333
Other methods are available for estimation,
minque is the default
27Proc mixed
proc mixed dataa1 cl class officer
model rating random officer/vcorr run
28Output
Covariance Parameter Estimates Cov Parm Est
Lower Upper officer 80.4 24.4
1498 Residual 73.2 39.9 175
80.4104/(80.410473.2833).5232
29Output from vcorr
Row Col1 Col2 Col3 Col4 1 1.0000 0.5232
0.5232 0.5232 2 0.5232 1.0000 0.5232 0.5232 3
0.5232 0.5232 1.0000 0.5232 4 0.5232 0.5232
0.5232 1.0000
30Other topics
- Estimate and CI for µ, p1038
- Standard error involves a combination of two
variances - Use MSA instead of MSE ? r-1 df
- Estimate and CI for sµ2 /(sµ2 s2), p1040
- CIs for sµ2 and s2, p1041-1047
- Available using Proc Mixed
31Applications
- In the KNNL example we would like sµ2 /(sµ2 s2)
to be small, indicating that the variance due to
interviewer is small relative to the variance due
to applicants - In many other examples we would like this
quantity to be large, - e.g., Are partners more likely to be similar in
sociability?
32Last slide
- Start reading KNNL Chapter 25
- We used program topic30.sas to generate the
output for today