Comparison of 2 or more means ( See Chapter 11)
e.g. n=16, df=15, alpha=0.05 t- statistic under H0 are ±2.13 Is = 0 ? -- consider versus or One sample t test
Population (Normal) T-treatmentC-control TT CC TT CC H 0 : T = C Two sample t
Population (Normal) T-treatmentC-control TT CC TT CC Sample nTnT nCnC sTsT sCsC H 0 : T = C Two sample t
1.Samples dependent (Paired) (1 sample of subjects, 2 measures/subject) 2.Samples independent (2 independent samples of subjects, 1 measure per subject) Two situations:
Example – Paired study Each subject is tested under 2 conditions: –Time to angina when exposed to plain air –Time to angina when exposed to air + CO –Question: Is there evidence that the time to angina is shorter when there is exposure to Co?
Plain air Carbon monoxide Example – Paired study (Partial data)
Plain air Carbon monoxide Example – Paired study
Plain air Carbon monoxide Example – Paired study
Response Error Model for a Subject (s): At time 1 (Control) At time 2 (same) Measured under same conditions!
Example – Paired study Response Error Model for a Subject: At time 1 (control) At time 2 (with CO) Measured under different conditions! = The condition effect
Example – Paired study Take Difference -At time 1 At time 2 (+CO) Take Sample of Subjects, Test whether -CO reduces time to asthma
So Look at the differences:
So treat the d’s as the data and perform a one-sample t-test: T-test Average change in time to angina = SD of change in time to angina = n=63. Calculate p value for H 0 : μ=0 vs Ha: μ not 0
n= 63 Example - Paired study (Hypothesis test) Compare with t (.05,62)= Since tcal<-1.671, reject Ho. Conclude time is shorter.
In order to decide the s 1 2 and S 1 2 and the degrees of freedom we need to know whether, or not, T = C 2. For two independent samples:
If T C (recommended) and degrees of freedom, : Heteroscedastic
If T = C (which can be tested) we can use a common value: Homoscedastic
Two samples (groups): Treatment Control Example
Stata Output paired t. ttest var1 = var2 Paired t test Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] var1 | var2 | diff | Ho: mean(var1 - var2) = mean(diff) = 0 Ha: mean(diff) 0 t = t = t = P |t| = P > t =
Stata Output unpaired t. ttest var1 = var2, unpaired Two-sample t test with equal variances Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] var1 | var2 | combined | diff | Degrees of freedom: 6 Ho: mean(var1) - mean(var2) = diff = 0 Ha: diff 0 t = t = t = P |t| = P > t =
Stata Output unpaired unequal. ttest var1 = var2, unpaired unequal Two-sample t test with unequal variances Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] var1 | var2 | combined | diff | Satterthwaite's degrees of freedom: Ho: mean(var1) - mean(var2) = diff = 0 Ha: diff 0 t = t = t = P |t| = P > t =
Summary Paired test Hypothesis test CI 2 independent samples: –Hypothesis test for equal/unequal variance –CI under equal/unequal variance