W8 Hypothesis Testing
W8 Hypothesis Testing
3
HYPOTHESIS TESTING
Our objective is to choose between these two opposite statements about the population,
where these statements are known as hypotheses. By convention these are denoted by
𝐻0 & 𝐻1 .
There is no difference in the mean of the There is a difference in the mean of the
exam score between Class A and Class B exam score between Class A and Class B
4
HYPOTHESIS TESTING : EXAMPLE
Example : A coin is tossed 100 times in order to decide whether or not it is a fair coin.
𝐻0 : Prob of getting a head = prob of getting a tail = ½.
𝐻1 : Prob of getting a head ≠ prob of getting a tail.
We observe 98 heads and 2 tails. Common sense tells us that this is (very!) strong
evidence that the coin is biased toward heads.
More formally, we reject the null hypothesis that the coin is fair as the chance of obtaining 98
heads with a fair coin is extremely low - the observation, 98 heads, is inconsistent with the coin
being fair since we would have expected (approximately) 50 heads and the observation
significantly departed from this expectation.
5
TEST STATISTIC
In ‘classical testing’, we always assume the null hypothesis is true by performing the test conditional on
𝐻0 being true. That is, 𝐻0 is our ‘working hypothesis' which we hold to be true until we obtain significant
evidence against it.
Note:
• Different test statistics are used for testing different forms of hypotheses.
• Observed (or measured) test statistic is a value calculated from the sample data.
6
SIGNIFICANCE LEVELS
Definition: Significance level 𝛼 % is defined by the probability when rejecting 𝐻0 when it is true (i.e. a false
positive). It is sometimes referred to as type I error.
We control for the probability of committing a Type I error by setting the value for 𝛼.
Interpretation: If we perform a test at the 5% significance level, say, then we are basing our decision on a
procedure which gives us a 5% probability of making a Type I error when 𝐻0 is true.
7
If a test is performed at the 10% significance level, what
does it imply?
A. There is a 10% probability of rejecting a true null hypothesis
B. There is a 10% probability of accepting a false null hypothesis
What does the significance level measure?
A. Type II error
B. Beta level
C. Type I error
D. Alpha level
P-VALUES
Definition: p-value is the probability of obtaining test result at least as extreme as observed test statistic
under the assumption that the null hypothesis is true.
10
PROCEDURE OF HYPOTHESIS TESTING (P-VALUE APPROACH)
Decide whether or
Draw conclusions
not to reject 𝐻0
11
CHI-SQUARED 𝝌𝟐
TEST
12
A chi-squared 𝜒 2 test is a statistical hypothesis test used in the analysis of contingency tables when the
sample sizes are large.
This type of test tests the null hypothesis that two factors (or attributes) are not associated, against the
alternative hypothesis that they are associated. That is,
• 𝐻0 : There is no association between Factor 1 and Factor 2. (or Factor 1 and Factor 2 are independent)
• 𝐻1 : There is an association between Factor 1 and Factor 2. (or Factor 1 and Factor 2 are dependent)
CHI-SQUARED 𝜒 2 TEST: EXAMPLE
Example: The following cross-tabulation shows data on the 3,593 people who applied to graduate study at
the University X. Dung classified the applicants according to their sex, and whether or not they were
admitted to the university.
Admitted
Sex No Yes Total
Male 1,180 686 1,866
Female 1,259 468 1,727
Total 2,439 1,154 3,593
INPUT DATA
CHI-SQUARED 𝜒 2 TEST: JASP EXAMPLE
p-value < 5%
Decision: Reject 𝐇𝟎 , there is sufficient evidence to suggest there is an association between decision of admission and gender.
CHI-SQUARED 𝜒 2 TEST: EXAMPLE
Example: Linh, however, decides to take another look at the statistics. She adds one more piece of data, the
department to which each person applied, and creates cross-tabulations separately for each department
(which are labelled A, B and C).
Admitted
Department Sex No Yes Total
A Male 207 353 560
Female 8 17 25
B Male 484 258 724
Female 635 346 968
C Male 489 75 564
Female 616 105 734
Total Total 2,439 1,154 3,593
p-value > 5%
Decision
p-value > 5%
???
p-value > 5%