Statistic work

profilemehett
hypothesis_testing.pdf

Hypothesis Testing-Terminology

• The Null Hypothesis: • The two samples are from the same population

• 𝜇1 = 𝜇2

• The hypothesis that (in most cases) we wish to reject

• The Alternative Hypothesis: • The two samples are not drawn from the same population

• 𝜇1 ≠ 𝜇2

• We can never accept this hypothesis but we can find that it more likely by rejecting the null hypothesis

The Null versus Alternative Hypothesis- Example

• Do Democrats and Republicans differ in their support for gun control? • 𝐻0: There is no difference between Democrats and Republicans in their

support for gun control

• 𝐻𝐴: Democrats and Republicans do differ in their support for gun control

• Do males and females differ in their preferences for the Democratic party over the Republican Party? • 𝐻0: There is no difference between males and females in their preference for

the Democrats over the Republicans

• 𝐻𝐴: Males and females do differ in their preference for the Democratic party over the Republican Party

Hypothesis Testing- Terminology cont.

• Sampling Distribution of Differences between Means- a distribution of a large number of differences between sample means

Hypothesis Testing- More Terminology

• Alpha (α)- the level of significance we set

• Rejection Region- the area that we reject the null hypothesis if we get a Z or T score above Alpha Z Value Rejection Region

.05 1.96

.01 2.58

Hypothesis Testing- More Terminology cont.

• Type 1 Error- when we reject the null hypothesis when it is in fact true • Probability of a type 1 error = α

• Type 2 Error- when we fail to reject the null hypothesis when it is in fact false • Probability of a type 2 error = 1 - α

Hypothesis Testing General Procedure

• Establish hypotheses

• Collect sample data

• Calculate statistics to evaluate how likely the sample results are given the hypothesis

• Decide on the basis of the statistics whether to reject or fail to reject the null hypothesis

Difference of Means Hypothesis Testing- General Intuition

• Assume that the null hypothesis is correct (i.e. the difference between population means is 0) • 𝜇1 − 𝜇2 = 0

• Calculate the observed difference of means between the samples • 𝑋1 − 𝑋2

• Calculate the probability that we would obtain a difference as extreme as the one we found if the null hypothesis is true

• Reject the null hypothesis if this probability is small enough • P > .05

Difference of Means Hypothesis Testing- General Intuition

Sampling distribution of difference of means statistic (assuming the null hypothesis is correct)

𝜇1 − 𝑢2

P P

Difference of Means Testing- Overview

• Calculate the sample means 𝑋1 𝑎𝑛𝑑 𝑋2 • Calculate the difference between sample means

• 𝑋1 − 𝑋2

• Translate the mean difference into a T score

• 𝑇 = 𝑋1 − 𝑋2

𝑆 𝑋1 − 𝑋2 𝑆 𝑋1 − 𝑋2 =

𝑁1 𝑆1 2+ 𝑁2+𝑆2

2

𝑁1+𝑁2 −2

𝑁1+ 𝑁2

𝑁1𝑁2

• Compare the observed T value to the table T value • If observed T > Table T, p will be >.5 and you can reject the null

• If observed T < Table T, p will not be >.5 you fail to reject the null

Differences in Means Testing

• Do our sample means differ significantly from each other or are they from the same distribution?

0 .1

.2 .3

.4

-6 -4 -2 0 2 4 x

Step by Step Procedure

1) Define Significance Level, e.g. α = 0.05

2) Specify Null and Alternative Hypothesis:

H0 : HA :

> We are comparing the means of two samples with each other! Are they significantly different?

Step by Step Procedure

3) Find the critical value

> t-score given by e.g. α = 0.05 and d.f. = n1+n2–2

4) Calculate the test statistic:

5) Compare test statistic to the critical value

if , reject H0 , else retain H0

Example

• We ask a random sample of people about their attitude towards gun control on a feeling thermometer from 0-100 with the following results:

Liberals Conservatives

n = 25 n = 35

mean = 60 mean = 49

s.d. = 12 s.d. = 14

• Are the two groups different?

Example

1) Define Significance Level: α = 0.05

2) Specify Null and Alternative Hypothesis:

H0 : HA :

3) Find critical the value (α = 0.05 and d.f. = n1+n2–2)

Example 4) Calculate the test statistic:

5) Compare test statistic to the critical value since , we can reject H0!

> Liberals show greater support for gun control than conservatives.