0% found this document useful (0 votes)
36 views15 pages

Hypothesis Tests

- Hypothesis tests involve testing a null hypothesis (H0) against an alternative hypothesis (H1) - H0 is assumed true until evidence in the data suggests it should be rejected in favor of H1 - The significance level α is the probability of rejecting H0 when it is true (Type I error) - A p-value less than α provides sufficient evidence to reject H0 in favor of H1

Uploaded by

Dorian Grey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views15 pages

Hypothesis Tests

- Hypothesis tests involve testing a null hypothesis (H0) against an alternative hypothesis (H1) - H0 is assumed true until evidence in the data suggests it should be rejected in favor of H1 - The significance level α is the probability of rejecting H0 when it is true (Type I error) - A p-value less than α provides sufficient evidence to reject H0 in favor of H1

Uploaded by

Dorian Grey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Hypothesis tests

Hypothesis
H0: Null-hypothesis is an conjecture which we assume is
true until we have too much evidence against it.
H1: The alternative hypothesis covers the alternative to H0

Notice: We either reject or cannot reject the null-hypothesis


– we never accept (or prove) the null-hypothesis.

Legal analogy:
H0: Innocent vs H1: Guilty
Procedure: Defendant is assumed innocent (H0) until
enough evidence suggest he is guilty..
1 lecture 8
Hypothesis tests
Examples of hypotheses
The mean height of men is 1.80 cm: H 0 : µ = 180
H1 : µ ≠ 180

The mean age of when people H 0 : µ ≥ 18


leave home is higher than 18 H1 : µ < 18
years:

The average price of milk in 7-11 is H 0 : µ 7 −11 − µb = 2


2 kr higher than in Brugsen: H1 : µ 7 −11 − µb ≠ 2
Notice: H0 always involves equality (≤,≥, or =)
2 lecture 8
Hypothesis tests
One-sided and two-sided tests
One-sided test:
H 0 : θ ≥ θ0 H 0 : θ ≤ θ0
H1 : θ < θ 0 H1 : θ > θ 0

Two-sided test:
H 0 : θ = θ0
H1 : θ ≠ θ 0

3 lecture 8
Hypothesis tests
Test statistics
Recall: A sample function is a function of data

Test statistic: a sample function θ, which


indicates if the null hypothesis should be
rejected or not.
Critical area: if θ lies in the critical area then
the null-hypothesis is rejected.
Critical values: boundary points for the critical
area.

4 lecture 8
Hypothesis tests
Type I and type II errors
Type I error: H0 rejected, when H0 is true.
Type II error: H0 not rejected, when H0 is false.
Significance level: α is the probability of
committing a Type I error.

One-sided test Two-sided test

α
5 α /2 lecture 8
Test of mean
Variance known (two-sided)
Hypothesis: Significance level:
H 0 : µ = µ0  X − µ0 
P − zα / 2 < < zα / 2  = 1 − α
H1 : µ ≠ µ 0  σ/ n 

Test statistics: Critical values:


x − µ0
z= − zα / 2 , zα / 2
σ/ n

Decision: reject H0 if z does not lie between the


critical values, otherwise we cannot reject H0.
6 lecture 8
Test of mean
Variance known
Problem: Anders claims that a flight to
Paris on average costs 5000 kr. For
a sample fo ten flights to Paris he
finds a sample average of 4850kr.

1. Rephrase Anders’ claim as a statistical


hypothesis.
2. Assume that the standard deviation of prices
of flights to Paris is 100 kr. Is Anders’
hypothesis reasonable at the 5% significance
level?
lecture 8
7
Hypothesis tests
p-value
Assuming that H0 is true, the p-value is the
probability of observing a more extreme test
statistics than the one just observed.
The null-hypothesis if rejected if p-value < α.

One-sided test Two-sided test

p
8 θ θ lecture 8
Test of mean
Variance known
Problem (cont.): Anders claims that a
flight to Paris on average costs
5000 kr. For a sample fo ten flights
to Paris he finds a sample average
of 4850kr.

3. Calculate the p-value and compare it to the


significance level (we still assume the
standard deviation to be 100kr).

lecture 8
9
Hypothesis test and
confidence intervals
The connection with confidence intervals:
x − µ0
− zα / 2 < < zα / 2
σ/ n

σ σ
x − zα / 2 < µ 0 < x + zα / 2
n n
That is, the null-hypothesis, µ = µ0, is
rejected if and only if µ0 lies outside the
confidence interval.
10 lecture 8
Test of mean
Variance known (one-sided)
Hypotheses: Significance level:
H 0 : µ ≥ µ0  X − µ0 
P − zα <  = 1−α

H1 : µ < µ 0 σ
 / n 
Test statistic: Critical value:
x − µ0 − zα
z=
σ/ n

Decision: Reject H0 if z lies below the critical value.

11 lecture 8
Test of mean
Variance unknown (two-sided)
Hypotheses: Significance level:
H 0 : µ = µ0  X − µ0 
P − tα / 2,n −1 < < tα / 2,n −1  = 1 − α
H1 : µ ≠ µ 0  s/ n 

Test statistic: Critical values:


x − µ0 − tα / 2,n −1 , tα / 2,n −1
t=
s/ n

Decision: Reject H0 if z does not lie between


the critical values.
12 lecture 8
Test of mean the MATLAB way
Variance unknown (two-sided)
Default: H0: µ = µ0 Data µ0 = 5000
>> [h,p,ci,stats]=ttest(x,5000,0.01)

h = Significance level α = 0.01


h=0: H0 not rejected
1 h=1: H0 rejected
p =
0.0013 p-value
ci =
1.0e+003 * (1-α)100% confidence interval
4.7436
4.9564 x − µ0
stats = tstat =
s n
tstat: -4.5804
df: 9 df = degrees of freedom
sd: 103.5584
sd = sample standard deviation
13 lecture 8
Test of mean the R way
Variance unknown (two-sided)
Data µ0 = 5000
> t.test(x=x,mu=5000,conf.level=0.99)

One Sample t-test Confidence level: 1-α = 0.99

data: x
t = -4.5804, df = 9, p-value = 0.001327
alternative hypothesis: true mean is not equal to 5000
99 percent confidence interval:
4743.574 4956.426
sample estimates:
mean of x
4850

14 lecture 8
Hypothesis tests
A couple of remarks
Many tests exist in both a two-sided and a one-
sided versions:
 Null-hypotheses: ≤, =, or ≥
 Critical values: one-sided use α
two-sided use α/2

We can reject H0 in three equivalent way:


 The test statistic is in the critical area
 The p-value < α
 Hypothesised value (e.g. µ0) is outside the
confidence intervals (only for two-sided tests)
15 lecture 8

You might also like