biol 4605/7220 ch 13.3 paired t-test
DESCRIPTION
BIOL 4605/7220 Ch 13.3 Paired t-test. GPT Lectures Cailin Xu. October 26, 2011. Overview of GLM. Simple regression Multiple regression. Regression. ANOVA. Two categories (t-test) Multiple categories - Fixed (e.g., treatment, age) - Random (e.g., subjects, litters). - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/1.jpg)
BIOL 4605/7220
Ch 13.3 Paired t-testGPT
LecturesCailin XuOctober 26,
2011
![Page 2: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/2.jpg)
Overview of GLM
GLM
Regression
ANOVA
ANCOVA
One-Way ANOVA
Two-Way ANOVA
Simple regression Multiple
regression
Two categories (t-test) Multiple categories - Fixed (e.g., treatment, age) - Random (e.g., subjects, litters)
2 fixed factors 1 fixed & 1 random (e.g., Paired t-test)
Multi-Way ANOVA
![Page 3: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/3.jpg)
GLM: Paired t-test
Two factors (2 explanatory variables on a nominal
scale)
One fixed (2 categories)
The other random (many categories)
+Fixed factor
Random factor
Remove var. among units → sensitive test
![Page 4: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/4.jpg)
GLM: Paired t-test
Effects of two drugs (A & B) on 10 patients
Fixed factor: drugs (2 categories: A & B)
Random factor: patients (10)
Remove individual variation (more sensitive test)
An Example:
![Page 5: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/5.jpg)
GLM: Paired t-test
Hours of extra sleep (reported as averages) with
two
Drugs (A & B), each administered to 10 subjects
Response variable: T = hours of extra sleep
Explanatory variables: drug & subject
Data:
Fixed Nominal scale (A &
B)
Random Nominal scale (0, 1, 2, . . .
, 9)
)( DX )( SX
![Page 6: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/6.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
ANOVA
Recompute p-value?
Declare decision: AHvsH .0Report & Interpr.of
parameters
Yes
No
![Page 7: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/7.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Verbal model
Hours of extra sleep (T) depends on drug ( ) DX Graphical model (Lecture notes Ch13.3, Pg 2)
Formal model (dependent vs. explanatory variables)
GLM form:
Exp. Design Notation:
resXXXXT SDSDSSDD 0
ijkijjiijk BBT )(
Fixed
Random
Interactive
![Page 8: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/8.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Formal model
GLM form: resXXXXT SDSDSSDD 0
Fixed
Random
Interactive effect
GLM form: resXXT SSDD 0
- Appears little/no- Limited data- Assume no
Fixed
Random Break
![Page 9: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/9.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Place data in an appropriate format Execute analysis in a statistical pkg: Minitab, R
Minitab: MTB> GLM ‘T’ = ‘XD’ ‘XS’;
SUBC> fits c4;
SUBC> resi c5.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ANOVA table, fitted values, residuals | (more commands to obtain parameter estimates)
![Page 10: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/10.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Place data in an appropriate format Execute analysis in a statistical pkg: Minitab, R
Minitab: MTB> means ‘T’
MTB> ANOVA ‘T’ = ‘XD’ ‘XS’;
SUBC> means ‘XD’ ‘XS’.
hours54.1ˆ0
![Page 11: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/11.jpg)
XD N MeansDrug effect
(fixed)-1 10 0.75 -0.791 10 2.33 0.79
XS N MeansSubject effect
(random)0 2 1.3 -0.241 2 -0.4 -1.942 2 0.45 -1.093 2 -0.55 -2.094 2 -0.1 -1.645 2 3.9 2.366 2 4.6 3.067 2 1.2 -0.348 2 2.3 0.769 2 2.7 1.16
Output from Minitab
hoursD 79.0ˆ
Means minus grand mean = parameter
estimates for subjects
0̂
![Page 12: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/12.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Place data in an appropriate format Execute analysis in a statistical pkg: Minitab, R
Minitab: R: library(lme4) model <- lmer(T ~ XD + (1|XS), data = dat) fixef(model)
fitted(model) residuals(model)
![Page 13: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/13.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption -- No line fitted, so skip
![Page 14: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/14.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption Homogeneous residuals? -- res vs. fitted plot (Ch 13.3, pg 4: Fig.1)
-- Acceptable (~ uniform) band; no cone
(skip)
(√)
![Page 15: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/15.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption Homogeneous residuals? If n small, assumptions met?
(skip)
(√)
![Page 16: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/16.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption Homogeneous residuals? If n (=20 < 30) small, assumptions
met? 1) residuals homogeneous? 2) sum(residuals) = 0? (yes, least squares)
(skip)
(√)
(√)
(√)
![Page 17: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/17.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption Homogeneous residuals? If n (=20 < 30) small, assumptions
met? 1) residuals homogeneous? 2) sum(residuals) = 0? (least squares)
3) residuals independent? (Pg 4-Fig.2; pattern of neg. correlation, because every value within A, a value of opposite sign within B) (Pg 4-Fig.3; res vs. neighbours plot; no trends up or down within each drug)
(skip)
(√)
(√)
(√)
(√)
![Page 18: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/18.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
(Residuals)
Straight line assumption Homogeneous residuals? If n small, assumptions met? 1) residuals homogeneous? 2) sum(residuals) = 0? (least squares)
3) residuals independent? 4) residuals normal? - Residuals vs. normal scores plot (straight line?) (Pg 4-Fig. 4) (YES, deviation small)
(skip)
(√)
(√)
(√)
(√)
(√)
![Page 19: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/19.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?
All measurements of hours of extra sleep, given the mode of collection
1). Same two drugs2). Subjects randomly sampled with similar characteristics as in the sample
![Page 20: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/20.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing?
Research question: Do drugs differ in effect, controlling for
individual variation in response to the drugs?
Hypothesis testing is appropriate
![Page 21: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/21.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
Hypothesis for the drug term: (not interested in whether subjects differ)
)()(:)()(:
0 BDAD
BDADA
TMeanTMeanHTMeanTMeanH
0:0:
0
D
DA
HH
Yes
![Page 22: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/22.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
Hypothesis for the drug term: (not interested in whether subjects differ)
Test statistic: F-ratio Distribution of test statistic: F-distribution Tolerance of Type I error: 5% (conventional level)
Yes
![Page 23: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/23.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
ANOVA
Yes
![Page 24: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/24.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSourceXXTGLM SSDD
:: 0
ANOVA
df : (20-1) = ? + ? + ? = (2-1) + (10-1) + (19-1-9) = 1 + 9 + 9
![Page 25: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/25.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
![Page 26: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/26.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
![Page 27: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/27.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
}]ˆ)([]ˆ)({[10 20
20 BDAD TmeanTmean
![Page 28: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/28.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
210
10ˆ2/2
iBDAD TT
![Page 29: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/29.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
SDTol SSSSSS
![Page 30: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/30.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
756.0/48.12/ resD MSMS
![Page 31: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/31.jpg)
General Linear Model (GLM) --- Generic Recipe
Calculate & partition df according to model
resSubjectDrugTotalSource :
ANOVA Table
ANOVA
df : 19 = 1 + 9 + 9
Source df SS MS F pDrug 1 12.48 12.48 16.5 0.0028Subject 9 58.08 6.45Res 9 6.81 0.756Total 19 77.37
MTB > cdf 16.5;SUBC> F 1 9. R:x P( X <= x ) 1-pf(16.5,1,9) 16.5 0.997167
![Page 32: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/32.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
ANOVA
Recompute p-value?
Yes
Deviation from normal small
p-value far from 5% No need to recompute
![Page 33: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/33.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
ANOVA
Recompute p-value?
Declare decision: AHvsH .0
Yes
.:.:0
drugsondependssleepextraHacceptdrugsondependnotsleepextraHreject
A
![Page 34: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/34.jpg)
General Linear Model (GLM) --- Generic Recipe Construct
model
Execute model
Evaluate model
State population; is sample representative?Hypothesis
testing? State pairAHH /0
ANOVA
Recompute p-value?
Declare decision: AHvsH .0Report & Interpret
parameters
Yes
No
![Page 35: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/35.jpg)
General Linear Model (GLM) --- Generic Recipe Report parameters & confidence
limits Subject: random factor, means of no
interest Drug effects ( )
hoursTmeanhoursTmean
BD
AD
33.2)(75.0)(
S.E. Lower limit Upper limit0.5657 -0.53 hours 2.03 hours0.6332 0.90 hours 3.76 hours
262.2]9[025.0 t
C.L. overlap, because subject variation is not controlled statistically
)10/( )( BorADTsd
![Page 36: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/36.jpg)
Paired t-test --- Alternative way
Calculate the difference within each random category
t-statistic
)(0028.0);(0014.0)9(06.4:
058.1
)(
0
tailstwotailonepdfstatistict
hoursTTmeanT ADBDdiff
S.E. L U0.389 0.70 hours 2.46 hours
1,
/
220
nres
sns
Tt diff
diff
diff
Strictly positive, significant difference between the drugs
Current example
![Page 37: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/37.jpg)
Subject Drug A Drug B1 0.7 1.92 -1.6 0.83 -0.2 1.14 -1.2 0.15 -0.1 -0.16 3.4 4.47 3.7 5.58 0.8 1.69 0 4.6
10 2 3.4
Data (hours of extra sleep)
![Page 38: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/38.jpg)
Graphical model
A B-2
-1
0
1
2
3
4
5
6
Drug
Hour
s
![Page 39: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/39.jpg)
Data format in Minitab & RT XD XS
0.7 -1 0-1.6 -1 1-0.2 -1 2-1.2 -1 3-0.1 -1 43.4 -1 53.7 -1 60.8 -1 70 -1 82 -1 9
1.9 1 00.8 1 11.1 1 20.1 1 3-0.1 1 44.4 1 55.5 1 61.6 1 74.6 1 83.4 1 9
![Page 40: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/40.jpg)
![Page 41: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/41.jpg)
![Page 42: BIOL 4605/7220 Ch 13.3 Paired t-test](https://reader031.vdocuments.site/reader031/viewer/2022012917/568160b2550346895dcfd404/html5/thumbnails/42.jpg)
SubjectDrug ADrug
B Diff Fits Res1 0.7 1.9 1.2 1.58 -0.382 -1.6 0.8 2.4 1.58 0.823 -0.2 1.1 1.3 1.58 -0.284 -1.2 0.1 1.3 1.58 -0.285 -0.1 -0.1 0.0 1.58 -1.586 3.4 4.4 1.0 1.58 -0.587 3.7 5.5 1.8 1.58 0.228 0.8 1.6 0.8 1.58 -0.789 0 4.6 4.6 1.58 3.02
10 2 3.4 1.4 1.58 -0.18
Data (hours of extra sleep)