Lecture 8
Hypothesis Testing
Statistics for
Civil & Environmental Engineers
Relax a little and think about issue today!
Making Decisions
Do materials meet specifications?
Have pollutant levels increased?
Has streamflow been affected by urbanization?
Does new blend result in greater strength concrete?
Does SO2affect human health?
Is acid rain causing environmental damage?
Have new management procedures improved production?
How do we organize information?
Procedure for Testing
1. Declare a null hypothesis which is the hypothesis to be tested
2. An alternative hypothesis which we really wish to test
3. Determine a test statistic
4. Determine a level of significance α based on the known distribution of the test statistics
5. Define a rejection (or critical) region
6. Use the observed data to verify whether the computed value of the test statistic is within or outside the rejection region
Statistics for Civil & Environmental Engineers
Type I error
- The null hypothesis is rejected when it should be accepted
Type II error
- The null hypothesis is not rejected when it is not true
Probabilities of Type I and Type II Errors(1)
Definition
Reality
Decision H0true H1true
H0accepted H0rejected
Type I error depends on probability α
Type II error depends on α, the sample size, the true value of parameters
Probabilities of Type I and Type II Errors(2)
Properties
Statistics for Civil & Environmental Engineers
Null Hypothesis H0: µ1= µ2
One-tailed Tests:
H1: µ1< µ2(lower tail test) Rejection Region: Xtest≤ -xα
H1: µ1> µ2(upper tail test) Rejection Region: Xtest≥ -xα
Type of Tests(1)
f(x|H0) α
-xα
f(x|H0) α
Type of Tests(2)
Two-tailed Test:
H1: µ1≠µ2 Rejection Region: |Xtest| ≥-xα
Equivalently, if Xtest≥ xα/2or Xtest≤ -xα/2
f(x|H0)
α/2 Xα/2 -xα/2
α/2
Statistics for Civil & Environmental Engineers
Null hypothesis H0: µ=µ0
Alternative hypothesis H1: µ≠µ0
Two-tailed Example (1)
Hypothesis
Test Statistic
Standardized Test Statistic
Two-tailed Example (2)
Type II error for a given α
The probability βof a Type II error is dependent on α, n, and c/σ
1-α β
α 1-β
Accept H0
Accept H1
H0 true H1 true
Statistics for Civil & Environmental Engineers
For the same sample size n, β decrease as c/σ increases β decreases as the sample size nincreases
Two-tailed Example (3)
Characteristic Curves
The complement of β
Probability of rejecting the null hypothesis when it is not true
Power Function
Properties
Power Function Example
Power Curve Example
Definition: Probability we do the right thing
1-α β
α 1-β
Accept H0
Accept H1
H0 true H1 true
Statistics for Civil & Environmental Engineers
One-tailed Example 1: Testing n=1 beam (1)
Do we have the premium beams, or the regular beams?
Testing n=1 beam
Premium: X ~ N[12, 12] Regular: X ~ N[11, 12]
State #1 – H0: µ= 12 (σ=1) State #2 – H1: µ= 11 (σ=1)
8 9 10 11 12 13 14 15
f(x|H1) f(x|H0)
Need a Decision Rule – Once a week test a beam:
Accept H0: µ= 12 if X > cX Accept H1: µ= 11 if X ≤ cX
c= critical x-value for test X ≤ c is rejection regionfor H0
Type I error
One-tailed Example 1: Testing n=1 beam (2)
Statistics for Civil & Environmental Engineers
Type II error
β= P[Accept H0| H0false]
f(x|H1) f(x|H0)
α c β
1-α β
α 1-β
Accept H0
Accept H1
H0 true H1 true
One-tailed Example 1: Testing n=1 beam (3)
cX α β
9 0.0013 0.98
10 0.023 0.84
11 0.16 0.50
12 0.50 0.16
13 0.84 0.023
The Trade-off
Special values
10.72 0.10 0.76
9.67 0.01 0.91
β α
0.5
11 12
One-tailed Example 1: Testing n=1 beam (4)
Statistics for Civil & Environmental Engineers
Now, what if we select n=4 beams to test?
Do we have the premium beams, or the regular beams?
Use sample average to construct a decision procedure
X ~ N → X ~ N
E[X]= E[X] ; Var[X]= σ2/n
Premium: X ~ N[12, (1/4)]
Regular: X ~ N[11, (1/4)]
One-tailed Example 2: Testing n=4 beam (1)
New Trade-offs
cX α β
10 3x10-5 0.98
10.84 0.01 0.63
11 0.023 0.50
11.36 0.10 0.24
12 0.50 0.023
One-tailed Example 2: Testing n=4 beam (2)
Statistics for Civil & Environmental Engineers
X1, X2~ normal σ1and σ2are known
Testing The Difference Between Two Means Using Known Variances
Assumptions
Hypothesis
Test Statistic
where
X1, X2~ normal σ1= σ2
σ1and σ2are unknown
Testing The Difference Between Two Means When The Variances are Unknown But Equal
Assumptions
Hypothesis
Test Statistic
where
Statistics for Civil & Environmental Engineers
X1~ N(µ1, σ1) and X2~ N(µ2, σ2) σ1≠ σ2
σ1and σ2are unknown
Testing The Difference Between Two Means When The Variances are Unknown and Unequal
Assumptions
Hypothesis
Test Statistic
Degree of freedom:
Behrens-Fisher Problem
Testing The Difference Between Two Means Example
For others, see Table 5.4.1
Statistics for Civil & Environmental Engineers
Main steps
- The ranking of a sample of data
- Division into a number of classes depending on the magnitudes and the range
- The fitting of a probability distribution Test Statistic
Goodness-of-Fit Tests(1)
Chi-Squared Goodness-of-Fit Test
where Oi: observed frequency, Ei: expected frequency
Chi-Square Example(1)
Statistics for Civil & Environmental Engineers
Chi-Square Example(2)
Chi-Square Example(3)
Statistics for Civil & Environmental Engineers
Main steps
- A completely specified theoretical continuous cdf:
- The empirical or sample distribution function:
- The test statistics:
- Reject if D> Dn,α(Table C.7)
Goodness-of-Fit Tests(2)
Kolmogorov-Smirnov Goodness-of-Fit Test
Kolmogorov-Smirnov Example(1)
Statistics for Civil & Environmental Engineers
Kolmogorov-Smirnov Example(2)
Test Statistics
Goodness-of-Fit Tests(3)
PPCC Test
where, xi: ranked observation, wi: fitted qunatile(=G-1(1-qi)) r: correlation coefficient, qi(=pi): plotting position G(x): proposed cdf for the events
Statistics for Civil & Environmental Engineers
Goodness-of-Fit Tests(4)
Lower Critical Values for PPCC Test
Cartoon(1)
Statistics for Civil & Environmental Engineers
Cartoon(2)
Cartoon(3)
Statistics for Civil & Environmental Engineers
Cartoon(4)
Statistics for Civil & Environmental Engineers
Cartoon(5)
Cartoon(6)
Cartoon(7)
Statistics for Civil & Environmental Engineers