Title: Testing means, part III The twosample ttest
1Testing means, part IIIThe two-sample t-test
2One-sample t-test
Null hypothesis The population mean is equal to
?o
Sample
Null distribution t with n-1 df
Test statistic
compare
How unusual is this test statistic?
P gt 0.05
P lt 0.05
Reject Ho
Fail to reject Ho
3Paired t-test
Null hypothesis The mean difference is equal to ?o
Sample
Null distribution t with n-1 df n is the number
of pairs
Test statistic
compare
How unusual is this test statistic?
P gt 0.05
P lt 0.05
Reject Ho
Fail to reject Ho
4Comparing means
- Tests with one categorical and one numerical
variable - Goal to compare the mean of a numerical variable
for different groups.
5Paired vs. 2 sample comparisons
62 Sample Design
- Each of the two samples is a random sample from
its population
72 Sample Design
- Each of the two samples is a random sample from
its population - The data cannot be paired
82 Sample Design - assumptions
- Each of the two samples is a random sample
- In each population, the numerical variable being
studied is normally distributed - The standard deviation of the numerical variable
in the first population is equal to the standard
deviation in the second population
9Estimation Difference between two means
Normal distribution Standard deviation s1s2s
Since both Y1 and Y2 are normally distributed,
their difference will also follow a normal
distribution
10Estimation Difference between two means
Confidence interval
11Standard error of difference in means
pooled sample variance size of sample 1
size of sample 2
12Standard error of difference in means
Pooled variance
13Standard error of difference in means
Pooled variance
df1 degrees of freedom for sample 1 n1 -1 df2
degrees of freedom for sample 2 n2-1 s12
sample variance of sample 1 s22 sample variance
of sample 2
14Estimation Difference between two means
Confidence interval
15Estimation Difference between two means
Confidence interval
df df1 df2 n1n2-2
16Costs of resistance to disease
2 genotypes of lettuce Susceptible and
Resistant Do these differ in fitness in the
absence of disease?
17Data, summarized
Both distributions are approximately normal.
18Calculating the standard error
df1 15 -114 df2 16-115
19Calculating the standard error
df1 15 -114 df2 16-115
20Calculating the standard error
df1 15 -114 df2 16-115
21Finding t
df df1 df2 n1n2-2 1516-2 29
22Finding t
df df1 df2 n1n2-2 1516-2 29
23The 95 confidence interval of the difference in
the means
24Testing hypotheses about the difference in two
means
2-sample t-test
252-sample t-test
Test statistic
26Hypotheses
27Null distribution
df df1 df2 n1n2-2
28Calculating t
29Drawing conclusions...
Critical value
t0.05(2),292.05
t lt2.05, so we cannot reject the null hypothesis.
These data are not sufficient to say that there
is a cost of resistance.
30Assumptions of two-sample t -tests
- Both samples are random samples.
- Both populations have normal distributions
- The variance of both populations is equal.
31Two-sample t-test
Null hypothesis The two populations have the
same mean ?1??2
Sample
Null distribution t with n1n2-2 df
Test statistic
compare
How unusual is this test statistic?
P gt 0.05
P lt 0.05
Reject Ho
Fail to reject Ho
32Quick reference summary Two-sample t-test
- What is it for? Tests whether two groups have the
same mean - What does it assume? Both samples are random
samples. The numerical variable is normally
distributed within both populations. The
variance of the distribution is the same in the
two populations - Test statistic t
- Distribution under Ho t-distribution with
n1n2-2 degrees of freedom. - Formulae
33Comparing means when variances are not equal
Welchs t test
34Burrowing owls and dung traps
35Dung beetles
36Experimental design
- 20 randomly chosen burrowing owl nests
- Randomly divided into two groups of 10 nests
- One group was given extra dung the other not
- Measured the number of dung beetles on the owls
diets
37Number of beetles caught
38Hypotheses
- H0 Owls catch the same number of dung beetles
with or without extra dung (m1 m2) - HA Owls do not catch the same number of dung
beetles with or without extra dung (m1 ? m2)
39Welchs t
Round down df to nearest integer
40Owls and dung beetles
41Degrees of freedom
Which we round down to df 10
42Reaching a conclusion
t0.05(2), 10 2.23 t4.01 gt 2.23 So we can
reject the null hypothesis with Plt0.05. Extra
dung near burrowing owl nests increases the
number of dung beetles eaten.
43Quick reference summary Welchs approximate
t-test
- What is it for? Testing the difference between
means of two groups when the standard deviations
are unequal - What does it assume? Both samples are random
samples. The numerical variable is normally
distributed within both populations - Test statistic t
- Distribution under Ho t-distribution with
adjusted degrees of freedom - Formulae
44The wrong way to make a comparison of two groups
Group 1 is significantly different from a
constant, but Group 2 is not. Therefore Group 1
and Group 2 are different from each other.
45A more extreme case...