Bayes Theorem

Math/Stat 352
Lecture 18
Section 6.3 and 6.4
Large Sample test for population Proportion, Small Sample Test
for the Population Mean.
1
LARGE SAMPLE TESTS ON PROPORTIONS
Binomial experiment with n trials and unknown proportion of successes p.
GOAL: Test
Ho: p=p0 ,(p ≥ p0 or p ≤ p0) where p0 is a specified, known value.
DATA: Observe x successes, get sample proportion of successes
x
pˆ = .
n
Use the fact that statistic
z=
pˆ − p0
p0 (1 − p0 )
n
has approximately N(0, 1) distribution under Ho (when p=p0) for large n.
2
TEST FOR PROPORTION: PROCEDURE
Let significance level =α.
STEP 1. Ho: p = po (≤ or ≥) vs Ha: p ≠ po or (Ha: p > po or Ha: p < po)
STEP 2. Compute the test statistic:
pˆ − p0
z=
p0 (1 − p0 )
n
STEP 3. Find the critical number in the Z table.
Two sided alternative
critical value = zα/2.
One sided alternative
critical value = zα or - zα
STEP 4. DECISION.
Ha: p ≠ po Reject Ho if |z|> zα/2;
Ha: p > po Reject Ho if z > zα;
Ha: p < po Reject Ho if z < - zα.
STEP 5. Answer the question in the problem.
3
P-value approach
STEP 3. Compute the approximate p-value.
Two sided test p-value: Ha: p ≠ po, approximate P-value: 2P( Z > |z|)
One sided tests p-values: Ha: p > po, approximate P-value: P( Z > z)
Ha: p < po, approximate P-value: P( Z < z)
STEP 4. DECISION
Reject Ho if p-value < significance level α.
STEP 5. Answer the question in the problem.
4
Example: A survey of n = 880 randomly selected adult drivers showed that
56% of those respondents admitted to running red lights. Test the claim that
the majority of all adult drivers admit to running red lights on significance
level 0.01.
Solution. Let p=proportion of drivers who admit to running red lights.
STEP 1. Ho: p ≤ 0.5
H1: p > 0.5
STEP 2. Compute the test statistic:
=
z
pˆ − p0
0.56 − 0.5
= = 3.56
p0 (1 − p0 )
0.5(0.5)
880
n
STEP 3. Find the critical number zα=z0.01=2.33.
STEP 4. DECISION. test stat= 3.56 >z0.01=2.33 reject Ho
(Decision Rule: H1: p > po Reject Ho if z > zα;)
STEP 5. Answer the question in the problem.
There is significant evidence to support the claim that majority of adult
drivers admit to running the red lights.
5
EXAMPLE
Example. When a coin is tossed 100 times, we get 60 Heads. Test if the
coin is fair versus the alternative that it is loaded in favor of Heads,
using significance level of 5%.
Solution. X=number of H in 100 tosses of a coin; n= 100, x=60, α = 5%.
p= true probability of H on the coin, X ~Bin(100, p).
STEP1. Ho: p ≤ 0.5
=
z
STEP 2. Test statistic
Ha: p > 0.5
pˆ − po
=
po (1 − po )
n
0.6 − 0.5
= 2.
0.5(1 − 0.5)
100
STEP 3. Critical value? z0.05 =1.645.
STEP 4. DECISION: z = 2 > 1.645 = z0.05
reject Ho.
STEP 5. The coin favors heads.
6
EXAMPLE contd.
P-value approach
STEP 3. To get p-value, we need the distribution of
pˆ .
By the Normal approximation to Binomial, under Ho,
p̂ has an
approximately Normal distribution with mean po =0.5 and
st. deviation
0.5(1 − 0.5)
= 0.05.
100
P-value =
P ( pˆ > 0.6) ≈ P ( Z > 2) =
0.0228.
STEP 4. DECISION: P-value = 0.0228 < α=0.05
reject Ho.
STEP 5. The coin favors Heads.
7
Example: When Gregory Mendel conducted his famous hybridization
experiments with peas, one such experiment resulted in offspring
consisting of 428 peas with green pods and 152 peas with yellow pods.
According to Mendel’s theory, 1/4 of the offspring peas should have yellow
pods. Use a 0.05 significance level with the P-value method to test the claim
that the proportion of peas with yellow pods is equal to 1/4.
Solution:
STEP 1: H0: p = 0.25
H1: p ≠ 0.25
Get n = 428 + 152 = 580, so ∧
p = 0.262, and p = 0.25, n = 580, α = 0.05, p =0.262
STEP 2: Compute the test statistic.
=
z
pˆ − po
=
po (1 − po )
n
0.262 − 0.25
= 0.67
0.25(1 − 0.25)
580
STEP 3. (P-value approach) Compute the approximate p-value
Since this is a two-tailed test, the P-value: 2P( Z > |0.67|)=2(0.2514)=0.5028
0.5028
8
Example contd.
STEP 3. (critical value approach) Compute the critical value:
Critical value: zα/2 =1.96
STEP 4. DECISION. (P-value approach)
Since p-value = 0.5028>0.05, do not reject Ho
OR
(critical value approach) Since test stat. 0.67< 1.96, do not reject Ho
STEP 5. Answer to the question in the problem: There is no sufficient
evidence to reject the claim that the proportion of peas with yellow
pods is different from 0.25.
9
6.4 ONE SAMPLE t-TEST FOR THE MEAN OF THE NORMAL
DISTRIBUTION
Let
X 1 , , X n
sample from N(μ, σ), μ and σ unknown , estimate σ using s.
Let significance level =α.
STEP 1. Ho: μ = μo (≤ or ≥ )
Ha: μ ≠ μo or
(Ha: μ > μo or Ha: μ < μo)
STEP 2. Compute the test statistic: t = x − µo
s/ n
STEP 3. Compute the critical number/value
depends on Ha.
Two sided alternative
critical value = tα/2(n-1).
One sided alternative
critical value = tα(n-1).
STEP 4. DECISION-critical/rejection regions, use t distribution with df=n-1.
Ha: μ ≠ μo Reject Ho if |t|> tα/2(n-1);
Ha: μ > μo Reject Ho if t > tα(n-1);
Ha: μ < μo
Reject Ho if t < - tα(n-1).
STEP 5. Answer the question in the problem.
10
P-value approach
STEP 3. Compute the p-value.
Two sided test p-value:
Ha: μ ≠ μo, P-value: 2P( t(n-1)> |t|)
One sided tests p-values:
Ha: μ > μo, P-value: P( t(n-1) > t)
Ha: μ < μo, P-value: P( t(n-1) < t)
value of a
t-random variable
with n-1 df
value of the
test statistic
STEP 4. DECISION
Reject Ho if p-value < significance level α.
STEP 5. Answer the question in the problem.
11
Example: Use t-table to find a range of values for the P-value
corresponding to the given results.
a)
In a left-tailed test, the sample size is 12, and the test statistic is t = –2.007.
b) In a right-tailed test, the sample size is 12, and the test statistic is t = 1.222.
c) In a two-tailed test, the sample size is 12, and the test statistic is t = –3.456.
Solutions:
a) The test is a left-tailed test with test statistic t = –2.007, so the P-value is the area
to the left of –2.007 which is the same as the area to the right of +2.007. Any test
statistic between 2.201 and 1.796 has a right-tailed P- value that is between 0.025
and 0.05. We conclude that 0.025 < P-value < 0.05.
b) The test is a right-tailed test with test statistic t = 1.222, so the P-value is the area to
the right of 1.222. Any test statistic less than 1.363 has a right-tailed P-value that is
greater than 0.10. We conclude that P-value > 0.10.
c) The test is a two-tailed test with test statistic t = –3.456. The P-value is twice the area
to the right of –3.456. Any test statistic greater than 3.106 has a two-tailed Pvalue that is less than 0.01. We conclude that P-value < 0.01.
12
EXAMPLE
A sample of 36 women resulted in mean height of 64” and sample variance = 25.
Are women, on average, shorter than 66”? Use 5% significance level. Assume
heights follow normal distribution.
Solution. x = 64, n=36, s2=25, μo=66, α = 5%.
STEP1. Ho: μ ≥ 66
Ha: μ < 66
STEP 2. Test statistic t =
x − 66 64 − 66
=
= −2.4.
5/6
5 / 36
STEP3. Critical value? Df=n-1=35 and t0.05(35) ≈ 1.69
STEP 4. DECISION: t = -2.4 < -t0.05(35) ≈ -1.69
reject Ho.
STEP5. On average, women are shorter than 66”.
13
EXAMPLE contd.
P-value approach
STEP 3.
P-value =
P(t (35) < −2.4) ≈ 0.01
STEP 4. DECISION: P-value=0.01 < sign. level = 0.05
reject Ho.
STEP5. On average, women are shorter than 66”.
14
EXAMPLE
Suppose a sample of size 16 results in mean of 10 and standard deviation of
3.2. Test Ho: μ = 8 vs. Ha: μ ≠ 8 using α=0.05.
Solution. x
= 10, n=16,
STEP1. Ho: μ = 8
s=3.2, μo=8, α = 5%.
Ha: μ ≠ 8
STEP 2. Test statistic = 2.5.
STEP3. Critical value? Df=n-1=15, α/2=0.025, and t0.025(15) =2.131.
STEP 4. DECISION: t = 2.5 > t0.025(15)=2.131, so we reject Ho.
STEP5. Reject Ho.
P-value = 2P(t(15)> 2.5). From t-table 0.02 < p-value < 0.05, so reject Ho.
15
Normal Distribution Versus Student t Distribution
The critical value in the preceding example was t = 2.131, but if the normal
distribution were being used, the critical value would have been z = 1.96.
The Student t critical value is larger (farther to the right), showing that
with the Student t distribution, the sample evidence (test statistic) must
be more extreme before we can consider it to be significant.
16
Testing using MINITAB
Example: Drivers running red lights.
Test and CI for One Proportion
Test of p = 0.5 vs p > 0.5
99% Lower
Sample X N Sample p
Bound
1
493 880 0.560227 0.520532
Exact
P-Value
0.000
Answer: Since the p-value=0.000 < 0.01=significance level, then we reject the null
hypothesis, and conclude that the true proportion of drivers that run red lights is
above 0.5.
17
Testing with MINITAB
Example: Mendel experiment with peas
Results
Test and CI for One Proportion
Test of p = 0.25 vs p not = 0.25
Exact
Sample X N Sample p
95% CI
P-Value
1
152 580 0.262069 (0.226707, 0.299875) 0.533
Answer: Since the p-value=0.533 > 0.05=significance level, then we do not
reject the null hypothesis, and conclude that the true proportion of peas
with yellow pods is equal to 0.25.
18
Testing with MINITAB
Example: Women’s heights.
Results
One-Sample T
Test of mu = 66 vs < 66
N Mean StDev
36 64.000 5.000
95% Upper
SE Mean
Bound
T
P
0.833
65.408
-2.40 0.011
Answer: Since the p-value=0.011 < 0.05=significance level, then we reject
the null hypothesis, and conclude that the true mean height of women is
smaller than 66”.
19
Testing with MINITAB
Example: Suppose a sample of size 16 results in mean of 10 and standard
deviation of 3.2. Test Ho: μ = 8 vs. Ha: μ ≠ 8 using α=0.05.
Results
One-Sample T
Test of mu = 8 vs not = 8
N Mean StDev SE Mean
95% CI
16 10.000 3.200 0.800
(8.295, 11.705)
T
P
2.50 0.025
Answer: Since the p-value=0.025 < 0.05=significance level, then we reject
the null hypothesis, and conclude that the true mean is different from 8.
20