T-tests for 2 Independent Means - University of Washington

T-tests for 2 Independent Means

February 17, 2021 Contents

t-test for 2 independent means Tutorial Example 1: one-tailed test for independent means, equal sample sizes Error Bars Example 2: two-tailed test for independent means, unequal sample sizes Effect size Power Using R to run a t-test for independent means Questions Answers

t-test for 2 independent means Tutorial

This t-test compares two means that are drawn independently. More specificically, the null hypothesis is that the two means are drawn from populations with the same mean (or means that differ by some fixed amount). Here's how to get to the independent means t-test in the flow chart:

1

START HERE

Test for = 0

Ch 17.2

1

number of correlation (r) measurement frequency

number of

1

correlations

scale

variables

2

Test for 1= 2

Ch 17.4

Means

2

2 test independence

Ch 19.9

2 test frequency Ch 19.5

z-test Ch 13.1

Yes

Do you

1

know ?

No

one sample t-test

Ch 13.14

number of

More than 2

number of

2

means

factors

1

1-factor

2

ANOVA

Ch 20

2-factor ANOVA Ch 21

independent measures

Yes

t-test

Ch 15.6

independent samples?

No

dependent measures t-test

Ch 16.4

The test estimates the probability of obtaining the observed means (or more extreme) if the null hypothesis is true. If this probability is small (less than alpha), then we reject the null hypothesis in support of the alternative hypothesis that the population means for the two samples are not the same (or differ by more than the fixed difference). Both the null and alternative hypotheses assume that the two population standard deviations are the same.

To conduct the test, we convert the two means and standard deviations into a test statistic which is drawn from a t-distribution under the null hypothesis:

t

=

x?-y?-(?x -?y )hyp sx?-y?

The term in the numerator, (?x - ?y)hyp, is the expected difference between means under the null hypothesis. Usually this number is zero, which is when we are simply testing if

the two means are significantly different from each other. So the simple case when we are

comparing means to each other the calculation for t simplifies to:

t

=

x?-y? sx?-y?

The denominator sx?-y? is called the pooled standard error of the mean. It is calculated by first calculating the pooled standard deviation:

sp =

(nx -1)s2x +(ny -1)s2y (nx -1)+(ny -1)

2

If you look at the formula for the pooled standard deviation, sp, you should see that it's sort of a complicated average of the two standard deviations. Technically, the calculation

inside the square root is really an average of the sample variances, weighted by their degrees

of freedom. Importantly, sp should always fall somewhere between the two sample standard deviations.

The pooled standard error is calculated from sp by:

sx?-y? = sp

1 nx

+

1 ny

This is sort of like how we calculated the standard error for the single sample t-test by diving the standard deviation by n.

You can go from standard deviations and sample sizes to the pooled standard error of the mean in one step if you prefer:

sx?-y? =

(nx -1)s2x +(ny -1)s2y (nx -1)+(ny -1)

(

1 nx

+

1 ny

)

Note: if the two sample sizes are the same (sx = sy = n), then the pooled standard error of the mean simplifies to:

sx?-y? =

s2x+s2y n

The degrees of freedom of the independent means t-test is the sum of the degrees of freedom for each mean:

df = (nx - 1) + (ny - 1) = nx + ny - 2

Example 1: one-tailed test for independent means, equal sample sizes

Suppose you're a 315 Stats professor who is intersted in the impact on remote education on learning. You do this by comparing Exam 2 scores from course taught in 2020 before the pandemic to the Exam 2 scores in the course taught in 2021 during the pandemic.

In 2020, the 81 Exam 2 scores had a mean of 81.72 and a standard deviation of 28.2834. The 81 Exam 2 scores in 2021 had a mean of 71.68 and a standard deviation of 33.3654. Let's run a hypothesis test to determine of the mean Exam 2 scores from 2020 is significantly greater than from 2021. Use = 0.05.

First we calculate the pooled standard error of the mean. Since the sample sizes are the same (nx = ny = 81):

sx?-y? =

s2x+s2y n

=

28.28342+33.36542 81

=

4.86

3

Our t-statistic is therefore:

t

=

x?-y? sx?-y?

=

81.72-71.68 4.86

=

2.07

This is a one-tailed t-test with df = 81 + 81 - 2 = 160 and = 0.05. We can find our critical value of t from the t-table:

df, one tail ... 158 159 160 161 162

0.25 ... 0.676 0.676 0.676 0.676 0.676

0.1 ... 1.287 1.287 1.287 1.287 1.287

0.05 ... 1.655 1.654 1.654 1.654 1.654

0.025 ... 1.975 1.975 1.975 1.975 1.975

0.01 ... 2.350 2.350 2.350 2.350 2.350

0.005 ... 2.607 2.607 2.607 2.607 2.607

0.0005 ... 3.353 3.353 3.352 3.352 3.352

Our critical value of t is 1.654. Here's where our observed value of t (2.07) sits on the t-distribution compared to the critical value (1.654):

2.07

area =0.05

-2

-1

0

1

2

t (df=160) 1.65

Our observed value of t is 2.07 which is greater than the critical value of 1.654. We therefore

reject H0 and conclude that the mean Exam 2 scores from 2020 is significantly greater than from 2021.

We can use the t-calculator to calculate that the p-value is 0.02:

Convert t to

t

df

(one tail)

(two tail)

2.07

160

0.02

0.0401

Convert to t

df

t (one tail)

t (two tail)

0.05

160

1.6544

1.9749

4

To state our conclusions using APA format, we'd state:

The Exam 2 scores of 2020 Psych 315 students (M = 81.72, SD = 28.2834) is significantly greater than the Exam 2 scores of 2021 Psych 315 students (M = 71.68, SD = 33.3654) t(160) = 2.07, p = 0.02.

Error Bars

For tests of independent means it's useful to plot our means as bars on a bar graph with error bars representing the standard errors of the mean. We calculate each standard error for each mean the usual way by dividing the standard deviation by the square root of each sample size:

For 2020,

sx?

=

sx n

=

28.2834 81

=

3.14

and for 2021,

sx?

=

sx n

=

33.3654 81

=

3.71

The error bars are drawn by moving up and down one standard error of the mean (sx?) for each mean (x?):

86 84 82 80 78 76 74 72 70 68

2020

Psych 315 students

2021

Exam 2 scores

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download