Download Part III The General Linear Model. Multiple Explanatory Variables

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Part IV
The General Linear Model.
Multiple Explanatory Variables
Chapter 13.3
Fixed *Random Effects
Paired t-test
Overview of GLM
Regression
 Simple regression
 Multiple regression
ANOVA
 Two categories (t-test)
GLM
One-Way ANOVA
 Multiple categories
- Fixed (e.g., treatment, age)
- Random (e.g., subjects, litters)
Two-Way ANOVA
 2 fixed factors
 1 fixed & 1 random
(e.g., Paired t-test)
Multi-Way ANOVA
ANCOVA
GLM: Paired t-test
 Two factors (2 explanatory variables on a nominal scale)
 One fixed
(2 categories)
 The other random
Fixed
factor
+
(many categories)
Random factor
Remove var. among units
→ sensitive test
GLM | Paired t-test
• Sleep data example, used by W.
Gosset (1908) in the paper that
introduced the t-test
• Are the effects of 2 sleep
inducing drugs: Hyoscyamine
(Drug A) and L Hyoscine (Drug
B), controlled for among subject
variation, different?
Data are means
Subject
DrugA
Drug B
1
0.7
1.9
2
-1.6
0.8
3
-0.2
1.1
4
-1.2
0.1
5
-0.1
-0.1
6
3.4
4.4
7
3.7
5.5
8
0.8
1.6
9
0.0
4.6
10
2.0
3.4
1. Construct Model
Response variable: T=hours of extra sleep – ratio scale
Explanatory variables:
1. Drug. XD = Drug A, Drug B. Nominal scale
Fixed effect
2. Subject. XS = [1,2,…,10]. Nominal scale
Random effect
Mean value for each subject varies randomly and
is not under the control of the investigator
1. Construct Model
Verbal: Hours of extra sleep depends on drug.
Graphical:
1. Construct Model
Verbal: Hours of extra sleep depends on drug.
Graphical:
1. Construct Model
Verbal: Hours of extra sleep depends on drug.
Graphical:
1. Construct Model
Formal:
Can we have an interaction term?
Let’s look at the df
dfDrug
=
dfSubject
=
dfDrug*Subject =
Dfresidual
=
1. Construct Model
Verbal: Hours of extra sleep depends on drug.
Graphical:
1. Construct Model
Formal:
Revised Model:
2. Execute analysis
XS
T
XD
1
0.7
A
2
-1.6
A
3
-0.2
A
4
-1.2
A
5
-0.1
A
6
3.4
A
7
3.7
A
8
0.8
A
9
0.0
A
10
2.0
A
1
1.9
B
2
0.8
B
lm1 <- lm(T~XS+XD, data=sleep)
R: multiple ways to model random
effects
Instead of lm:
lmer{lme4}
lme{nlme}
use aov() , specifying
Error(subject)
2. Execute analysis
1. Compute
ˆ0  1.54 hs
2. Compute mean per drug
3. Compute drug effect
mean (TD=A)= 0.75 hs
ˆ D A  (0.75  1.54)hs  0.79 hs
4. Compute mean per subject
5. Compute subject effect
6. Compute fits
7. Compute residuals
mean(TS=1)= 1.3 hs
ˆ S 1  (1.3  1.54)hs  0.24 hs
fits  ˆ0  ˆ D  ˆS
residuals = T - fits
2. Execute analysis
ˆ0  1.54 hs ; ˆ D A  0.79 hs ; ˆ S 1  0.24 hs
β0
βD
βS
XS
T
XD
fits
res
1
0.7
A
1.54 -0.79 -0.24
0.51
-0.19
2
-1.6
A
1.54 -0.79 -1.94 -1.19
0.41
3
-0.2
A
1.54 -0.79 -1.09 -0.34 -0.14
4
-1.2
A
1.54 -0.79 -2.09 -1.34 -0.14
5
-0.1
A
1.54 -0.79 -1.64 -0.89 -0.79
1
1.9
B
1.54
0.79
-0.24
2.09
0.19
2
0.8
B
1.54
0.79
-1.94
0.39
-0.41
3
1.1
B
1.54
0.79
-1.09
1.24
0.14
4
0.1
B
1.54
0.79
-2.09
0.24
0.14
5
-0.1
B
1.54
0.79
-1.64
0.69
0.79
3. Evaluate model
□
Straight line
model ok?
□
Errors
homogeneous?
□
□
Errors normal?
Errors
independent?
3. Evaluate model
□
Straight line
model ok?
□
Errors
homogeneous?
□
□
Errors normal?
Errors
independent?
3. Evaluate model
□
Straight line
model ok?
□
Errors
homogeneous?
□
□
Errors normal?
Errors
independent?
3. Evaluate model
□
Straight line
model ok?
□
Errors
homogeneous?
□
□
Errors normal?
Errors
independent?
4. State the population and whether the sample is
representative.
Drugs set by experimental design  fixed effects
We will infer only to those drugs
Subjects, chosen at random. Hopefully from a larger
population  random effects
Population of all possible measurements of hours of extra
sleep, given the mode of collection
Infer to a population of subjects with characteristics similar
to those in the study
5. Decide on mode of inference. Is hypothesis
testing appropriate?
6. State HA / Ho pair, test statistic, distribution,
tolerance for Type I error.
– Assume no interaction, i.e. effect of drug is
consistent across subjects
– Focus on drug effect
6. State HA / Ho pair, test statistic, distribution,
tolerance for Type I error.
Test Statistic
Distribution of test statitstic
Tolerance for Type I error
7. ANOVA
Source
n = 20
df
SS
Subject
Drug
Res
Total
______ ______
MS
F
p
7. ANOVA
n = 20
Source
df
SS
Subject
9
58.078
Drug
1
12.482
Res
Total
___9__ _6.808
19
77.37
MS
F
p
7. ANOVA
n = 20
Source
df
Subject
9
58.078 6.453
Drug
1
12.482 12.48
Res
Total
SS
MS
___9__ _6.808 0.7564
19
77.37
F
p
7. ANOVA
n = 20
Source
df
Subject
9
58.078 6.453
Drug
1
12.482 12.48
Res
Total
SS
MS
___9__ _6.808 0.7564
19
77.37
F
p
16.5
0.0028
7. ANOVA
n = 20
Source
df
Subject
9
58.078 6.453
Drug
1
12.482 12.48
Res
Total
SS
MS
F
p
16.5
0.0028
___9__ _6.808 0.7564
19
r2 = 0.91
77.37
BUT we did this before  Ch 10.2 2 sample t-test
Source
Drug
Res
Total
df
SS
MS
F
p
1
12.48
12.48
3.4626
0.079
__18__ 64.886 3.6048
19
77.37
r2 = 0.16
8. Decide whether to recompute p-value
Slight deviation from normality
n<30, p=0.0028 not near α  no need to recompute
9. Declare decision about terms
Only the fixed term was tested p=0.0028 < α =0.05
Reject H0  extra sleep depends on drug administered
We did a 2 way ANOVA, also known as a paired t-test.
1 random factor
1 fixed factor with 2 levels
9. Declare decision about terms
Paired t-test:
1. Calculate difference within each random category
2. Test if the mean diff differs from zero
A
B
A-B
fits
res
0.7
1.9
1.2
1.58
-0.38
-1.6
0.8
2.4
1.58
0.82
-0.2
1.1
1.3
-1.2
0.1
1.3
1.58
-0.28
-0.1
-0.1
0.0
1.58
-1.58
3.4
4.4
1.0
1.58
-0.58
3.7
5.5
1.8
1.58
0.22
0.8
1.6
0.8
1.58
-0.78
1.58
p=0.0028
-0.28
10.Report and interpret parameters of
biological interest
Means per drug, not controlled for among subject
variation
SE
LCL (5%)
UCL(95%)
mean(TA)=0.75 hs
0.5657
-0.53 hs
2.03 hs
mean(TB)=2.33 hs
0.6332
0.89 hs
3.76 hs
Confidence limits for the average difference, controlled
for among subject variation
mean(TB-TA)=1.58
hs
SE
LCL (5%)
UCL(95%)
0.388
0.7 hs
2.46 hs
Quizz 7
Good luck!
Clock
Related documents