Professional Documents
Culture Documents
Often we have two unknown means and are interested in comparing them to each other. Usually the null hypothesis is H0: no difference between the population means There are a number of related testing procedures we will present. Which testing procedure you choose depends on your data. We will present three basic procedures here: Paired t-test for paired or matched data Two-sample t-tests for comparing two independent groups. Two basic independentsample tests will be presented: Equal variance t-tests: the two groups can be assumed to have equal variances. Unequal variance t-tests: the two groups are not assumed to have equal variances.
Paired t-test
When the means being compared come from observations that are naturally paired or matched, a paired t-test is used. Examples: Before vs after studies, also called longitudinal studies produce paired data. Each patient contributes two paired observations: the before value and the after value. Other types of studies can produce paired data also. One possibility would be a dental study where both opposing treatments are used in each patient, in randomly assigned half-mouths.
Comparing means of two independent samples These are called two-sample tests. Our goal is usually to estimate 1 - 2 and the corresponding confidence intervals and to perform hypothesis tests on: H0: 1 - 2 = 0. For each sample we compute the relevant statistics: Sample 1 Sample 2 n2 n1
X1
s1
X2
s2
The obvious statistic to compare the two population means is X 1 X 2 . Probability theory tells us that: 1. X 1 X 2 is the best estimate of 1 - 2
2 2 2. the standard error is 1 n1 + 2 n2
To perform the paired t-test, compute a one-sample t-test on the last column where H0: = 0.
T=
For a two-tailed test compare |-1.59|=1.59 to t9, .975 = 2.262. We do not reject since 1.59 < 2.262. P-value is P(|t9| > |-1.59|) = 2P(t9 > 1.59) = 0.15.
2 X 1 X 2 ~ N 1 2 , 12 n1 + 2 n2
In order to compute hypothesis tests and confidence intervals for 1 - 2 we will need to estimate the standard error of X 1 X 2 . Two different estimation procedures are commonly used depending on whether one feels it is reasonable to assume the two groups have similar variances. RULES OF THUMB for deciding whether to use the equal variance or unequal variance formulas 1. For small samples can use equal variance formulas unless s1 is twice as big as s2, or the other way around. 2. If n1 and n2 > 80 can use unequal variance formulae for SE (its easier to compute), and use the Normal distribution. 3. If you are unsure, the unequal variance formula will be the conservative choice (less power, but less likely to be incorrect). 4. The calculations are a snap with a computer program. If unsure about variance assumptions, compute the test both ways and see if there is a conflict.
This pooled standard deviation is roughly the combined distance of observations from their respective means. The T statistic
Tequal = X1 X 2 SE( X 1 X 2 ) ,
Example: Confidence Intervals for difference between means. Gum data from day 1. Gum A Gum C n2=40 n1=25 X 1 =-0.72 X 2 =2.63 s1=5.37 s2=3.80 Assume equal variances (s2 /s1< 2)
s pooled = 24 5.372 + 39 3.802 25 + 40 2 = 4.46 ,
change in DMFS
t-test for Equality of Means Sig. (2tailed) 0.005 Mean Difference -3.345 Std. Error Difference 1.138
SE ( X 1 X 2 ) 4.46 1 25 + 1 40 = 1.14 ,
Sig.
t -2.940
df 63
change in Equal DMFS variances assumed 0.924 0.340 Equal variances not assumed
-2.720
39.05
0.010
-3.345
1.230
95% Confidence Interval of the Difference Lower Upper -5.61840 -5.83279 -1.07160 -0.85721
Unequal Variance case: 1 2 If one is not sure that the variances are equal it is usually safest to assume that they are not. Standard Error of X 1 X 2 is estimated by
2 SE ( X 1 X 2 ) = s12 n1 + s2 n2 .
The T statistic
Tunequal = X1 X 2 SE ( X 1 X 2 ) ,
mean attachment Equal variances loss assumed Equal variances not assumed 95% Confidence Interval of the Difference Lower Upper
t-test for Equality of Means df Sig. Mean Std. Error (2-tailed) Difference Difference
5.682 0.02
1.980
805
0.048
0.22
0.109
(s
2 1
2 2
1.914
632.3
0.056
0.22
0.113
Note: If n1 and n2 > 80, then can use standard Normal distribution in place of t, which removes necessity to estimate degrees of freedom.
What to do? In this case choose the unequal-variances results. They rely less on assumptions, plus the sample sizes are large enough so that the SEM estimates are probably close to optimal even if the variances are equal.
0.002 -0.006
0.431 0.439
6/8/2010
15 implants were placed using each guide. Error (discrepancies with a reference implant) was measured for each implant.
0.23
0.24
0.25
H0: 1 = 2 = = K
0.26
0.27
4mm
8mm
0.27
The overall mean of the entire sample was 0.248 mm. This is called the grand mean, and is often denoted by X . If H0 were true then wed expect the group means to be close to the grand mean.
The ANOVA test is based on the combined distances from X . If the combined distances are large, that indicates we should reject H0.
0.26
0.25
0.24
0.23
4mm
8mm
0.23
0.24
0.25
0.26
0.27
4mm
8mm
6/8/2010
SSB = 15 X 4 mm X + 15 X 6 mm X + 15 X 8 mm X
where the X * are the group means.
Is that big enough to reject H0? As with the t test, we compare the statistic to the variability of the individual observations. In ANOVA the variability is estimated by the Mean Square Error, or MSE
0.4
0.3
MSE =
1 2 (xij X j ) N K j i
MSE =
1 2 (xij X j ) N K j i
0.2
4mm
8mm
Note that the variation of the means seems quite small compared to the variance of observations within groups
0.1
0.1
0.2
0.3
0.4
4mm
8mm
Notes on MSE
If there are only two groups, the MSE is equal to the pooled estimate of variance used in the equalvariance t test. ANOVA assumes that all the group variances are equal.
ANOVA F-statistic
The ANOVA is based on the F statistic
F=
SSB (K 1) MSE
Under H0 the F statistic has an F distribution, with K-1 and N-K degrees of freedom (N is the total number of observations)
6/8/2010
F(2,42) distribution
F(2,42) distribution
F=
The p-value is
0 1 2 F 3 4
0 0.211
2 F
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of Squares Between Groups Within Groups Total .005 .466 .470 Mean Square .002 .011 Sum of Squares Between Groups Within Groups Total .005 .466 .470
ANOVA Table
Results are often displayed using an ANOVA Table
Mean Square .002 .011
df 2 42 44
F .211
Sig. .811
df 2 42 44
F .211
Sig. .811
F Statistic
p value
The most simple post hoc test is called the Least Significant Difference Test. The computation is very similar to the equalvariance t test.
Which means are different? Can directly compare the subgroups using post hoc tests.
Sum of Squares Between 33383 Groups Within 4417119 Groups Total 4450502
df 3 2007 2010
F 5.1
Sig. .002
Compute an equal-variance t test, but replace the pooled variance (s2) with the MSE.
6/8/2010
T=
Sum of Squares Between 33383 Groups Within 4417119 Groups Total 4450502
df 3 2007 2010
F 5.1
Sig. .002
Periodontitis
Edentulous
Conclusion: The Edentulous group is significantly different than the Healthy group and the Gingivitis group (p < 0.05), after adjustment for multiple comparisons