Download STATISTICS 2 Hypothesis testing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Hypothesis testing:
Hypothesis testing is used for assessing evidence in favour or gaist, claims about population
distributions. Usually these are claims about parameters of population distributions (such as mean ,
which we will look at in this unit).
Hypothesis testing provides objecting way to test these claims.
The vocabulary is very elaborate but the basic idea is very simple and based on the following:
if the outcome, from a sample is very unlikely to happen given a claim is true, then this represents
evidence against the claim.
if the outcome, from a sample is very unlikely to happen given a claim is not true, then this
represents evidence in favour of the claim.
Example:
1) records indicates that the amounts paid per month by customers for long distance phone calls
have a mean of $18.75, and standard distribution of $7.80, assume normal distribution. a random
sample of 25 bills during a given month shows a sample mean of $21.25. is this enough evidence
that the average amount billed is are different than $18.75 (use Ξ±=0.05)
Sol):/
Normal population distribution
𝜎 = 7.8 (Οƒ is population standard distribution (S is sample standard distribution)
let ΞΌ be the mean amount billed.
Alternate hypothesis: 𝐻1 – the set of parameter values of ΞΌ, for which we seek evidence, in order to
claim that the true value of ΞΌ belong to this set.
𝐻1 : πœ‡ β‰  18.75
Usually 𝐻0 (null hypothesis) is the complement of 𝐻1
𝐻0 = πœ‡ = 18.75 vs 𝐻1 : πœ‡ β‰  18.75
Test Statistic:
𝑍=
π‘‹Μ…βˆ’πœ‡0
𝜎/βˆšπ‘›
where πœ‡0 = 18.75
Z has N(1,0) given 𝐻0 (null hypothesis) is true.
Critical region: (C.R.) the set of unlikely values of the test statistic give that 𝐻0 (null hypothesis) is
true, and these values favour the alternate hypothesis (not unlikely give 𝐻1 is true).
C.R. = {|𝑍| β‰₯ 𝑧𝛼 }
2
Ξ± – significance level (usually 0.01, or 0.05, or 0.001 )
Evaluate π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ from the sample:
π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ =
π‘₯Μ… βˆ’ 18.75
𝜎/√25
=
21.25 βˆ’ 18.75
7.8/√25
β‰ˆ 1.6
-Ξ± = 0.05 CR= {|𝑍| = 𝑧0.05 }= {|Z|β‰₯-1.96 }
π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ is not in CR therefore Do not reject 𝐻0 .
conclusion: there is not enough evidence, at the significance leval Ξ± =0.05, to suggest that the mean
amount billed is different that $18.75
Remark: if you don’t recect the null hypotisis you don’t accept it.
Steps in Hypothesis Testing
1) identify the relevan H_1 (alternate hypothies), abd H_0. (this depends on questiong of interst)
2) Identify the relevant test statistic, this depends on the model (populations distribution, and whatr
we know about it)
3) find the critical region, it depends on the H_1 alternate hypothesis
4) Stat clearly the conclusion from the test:
if the observed value from the test statistic is in the critical region, than reject 𝐻0 ,
you have enough evidence for .. (from contex – thje questions)
otherwise don Not reject 𝐻0 , and you do not have enough evidence for … (from context)
Example Q1:
β€œ1. Records indicate that the amounts paid per month by customers for longdistance
telephone calls have a mean of $18.75 and a standard deviation of $7.80.
Assume that these amounts are normally distributed. A random sample of 25 bills
during a given month produced a sample mean of $21.25. Is there enough evidence
from this sample to suggest that the amounts billed per month on long-distance calls
is greater than 18.75? (Use Ξ± = 0.05)”
Modal: normal population with Οƒknown:
Οƒ=7.8; n=25; π‘₯Μ… = 21.25
1:
𝐻1 : πœ‡ > 18.75
𝐻0 : πœ‡ ≀ 18.75
2: Test statistic: 𝑍 =
𝑋̅ βˆ’πœ‡0
𝜎/βˆšπ‘›
where πœ‡0 is 18.75 (the boundary point)
it’s distribution is N(0,1) given 𝐻0 is true (at the boundary point πœ‡0 )
3: Critical Region:
𝐢. 𝑅. = {𝑍 β‰₯ 𝑧𝛼 }
𝑒𝑠𝑒 𝛼 = 0.05
𝐢. 𝑅 = {𝑍 β‰₯ 1.645}
4) π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ =
π‘₯Μ… βˆ’18.75
𝜎/βˆšπ‘›
=
21.25βˆ’18.75
7.8√25
β‰ˆ 1.6
1.6 < 𝑧𝛼
π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ is not in the C.R do not Reject H_0
Conclusion: there is non teough ebidence, at \aplha=0.0o5 to suggest the average
amount billed is >18.75.
EXAMPLE 2:
2. A trucking firm believes that its mean weekly loss from damaged shipments is
less than $ 1800. Assume that the distribution of weekly losses is normal. A sample
of 15 weeks of operation shows a sample mean weekly loss of $ 1700 and a sample
standard deviation of $ 500. Is there enough evidence from this sample to suggest
that the belief of the trucking firm is justified?
Modal: normal population distribution
population Variance is not known. (ΞΌ is population mean)
Sample: n=15; s=500;
1)
𝐻1 : πœ‡ < 1800
vs
π‘₯Μ… = 1700
𝐻0 : πœ‡ β‰₯ 1800
2)
Test statistic:
𝑋̅ βˆ’πœ‡0
𝑆/βˆšπ‘›
=𝑇
T is distributed T with (n-1) degrees of freedom, given the null hypothesis is true at
the boundary point 1800
3)Critical region, rare vaules given null hyopothisis is true but not rare given alternate
hypothis is true>
look at tails, taile are rare given null is true
right value is rare when alternate true so no good.
if alternate is true then distribution shifted left, so not rare given alternate.
use left tail
let Ξ± =0.01
𝐢𝑅 = {𝑇 ≀ βˆ’π‘‘π›Ό,(π‘›βˆ’1) }
𝐢𝑅 = {𝑇 ≀ βˆ’π‘‘0.01,14 }
4)
π‘‡π‘œπ‘π‘  =
π‘₯Μ… βˆ’ 1800
=
1700 βˆ’ 1800
β‰ˆ βˆ’0.77
𝑠/βˆšπ‘›
500/√15
π‘‡π‘œπ‘π‘  is not in critical region. Do not reject 𝐻0 .
Conclusion: there ois not enough evidence at Ξ±=0.01 to suggest that the belief of
the company is justified.
Summery on CR
if the 𝐻1 : πœ‡ β‰  then CR is two tail, each area Ξ±/2
if the 𝐻1 : πœ‡ > then CR is right tail, area Ξ±
if the 𝐻1 : πœ‡ < then CR is left tail, area Ξ±
Errors associated with hypothesis testing:
1) Error associated with rejecting null hypothesis( 𝐻0 ) ;
1st type error: 𝑃(π‘Ÿπ‘’π‘—π‘’π‘π‘‘ 𝐻0 |𝐻0 π‘‘π‘Ÿπ‘’π‘’) (probability rejecting 𝐻0 , given 𝐻0 true)
if 𝐻1 : πœ‡ >? (ΞΌ in CR)
𝑃(π‘Ÿπ‘’π‘—π‘’π‘π‘‘ 𝐻0 |𝐻0 π‘‘π‘Ÿπ‘’π‘’) ≀ 𝛼
when H_0 is rejected we can say that H_1 is accepted,
2) if we do not reject the null hypothesis:
Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ… 𝐻0 |𝐻0 π‘‘π‘Ÿπ‘’π‘’
Μ…Μ…Μ…Μ…Μ…Μ…) (probability of not rejecting 𝐻0 , given that it
2nd type error: 𝑃(π‘Ÿπ‘’π‘—π‘’π‘π‘‘
is false.
is not under control.
therefore, when 𝐻0 is not rejected, you never say β€œaccept 𝐻0 ” because there could be
a large probability of error.
P-value
P-values is the probability of obtaining a value of the test statistic as extreme as, or
moire extreme than the observed value of the test statistic.
1) If 𝐻1 : πœ‡ >? p-value=𝑃(𝑇𝑒𝑠𝑑 π‘†π‘‘π‘Žπ‘‘π‘–π‘π‘–π‘ β‰₯ 𝑖𝑑 β€² 𝑠 π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ π‘£π‘Žπ‘™π‘’π‘’)
𝑃(𝑍 β‰₯ π‘§π‘œπ‘π‘  ),
𝑃(𝑇 β‰₯ π‘‘π‘œπ‘π‘  )
β€²
2) If 𝐻1 : πœ‡ <? p-value=𝑃(𝑇𝑒𝑠𝑑 π‘†π‘‘π‘Žπ‘‘π‘–π‘π‘–π‘ ≀ 𝑖𝑑 𝑠 π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘ π‘£π‘Žπ‘™π‘’π‘’)
3) If 𝐻1 : πœ‡ β‰ ? p-value=𝑃(|𝑍| ≀ |π‘§π‘œπ‘π‘  |)
(or relevant test statistic instead of Z)
We reject the null hypotheis (𝐻0 ) if and only iff p-values ≀α. (and so accept the
alternate)
otherwise we don’t reject the null hypothesis (but still can’t accept it)
EXAMPLE:
3. A company has produced a new type of steel-belted radial tire that it claims
will last at least 40000 km on the average. A random sample of 30 tires produced
a sample mean of 37000 km and a sample standard deviation of 2000 km. Is there
enough evidence from the sample to suggest that the company’s claim is not
justified?
Modal: unknown pop. dist.
sample size is large, 𝑛 = 30 β‰₯ 30
Sample: 𝑛 = 30, π‘₯Μ… = 37000, 𝑠 = 2000
𝐻1 : πœ‡ < 40000 ⟹ 𝐻0 : πœ‡ β‰₯ 40000
Test Statistic: ~ 𝑁(0,1) given 𝐻0 is true (at boundary πœ‡0 )
CR: = {𝑍 < βˆ’π‘§π›Ό } use Ξ±=0.01
𝐢𝑅 = {𝑍 ≀ βˆ’2.33}
Evalauate π‘π‘œπ‘π‘ π‘’π‘Ÿπ‘£π‘’π‘‘
π‘₯Μ… βˆ’ 40000
37000 βˆ’ 40000
=
= βˆ’8.22
𝑠
2000
βˆšπ‘›
√30
z_obs is in the C.R, so rfecject H_0
Conclusion: there is enough evidence to suggest that the claim is not justividfed (accept
H_1) at significance level Ξ± =1%
π‘§π‘œπ‘π‘  =
4. a magazine claims that at least 25% of it grsduates are collage graduates.
is there enough evidence to suggest aforementioned claim is not justified.
Sample stististics:
n=200, 41 of wich are colledge graduates.
Modal:
Pop dist: bernolli
𝑒π‘₯𝑝𝑒𝑐𝑑𝑒𝑑 π‘£π‘Žπ‘™π‘’π‘’ 𝑝̂ = 41/200
n=200
𝐻1 : 𝑝 < 0.25 vs 𝐻0 : 𝑝 β‰₯ 0.25
2. find test statistic:
π‘Μ‚βˆ’π‘0
βˆšπ‘0 (1βˆ’π‘0 )/βˆšπ‘›
= 𝑍 ~n(0,1) given 𝐻0 is true (𝑝 = 𝑝̂ )
𝑝0 = 0.25 (boundary point)
3. C.R alternate hypothesis (𝐻1 ) is p<25 therefor use left tail.
let Ξ± =0.05
𝐢𝑅 = {𝑍 ≀ βˆ’π‘§π‘œπ‘π‘  } = {𝑍 ≀ βˆ’1.645}
𝑝̂ βˆ’ 0.25
41/200 βˆ’ 0.25
π‘§π‘œπ‘π‘  =
=
= βˆ’1.47
√0.25 × 0.75/√200 √0.25 × 0.75/√200
π‘§π‘œπ‘π‘  outside CR, therefore don’t reject null hyupotheisis.
Conclusion: there is no evidence at Ξ±=0.05, to suggest that the claim is not justified.
Summery (hypothesis testing)
Modal
1. Normal population,
known 𝜎 2 (pop
variance)
2. Normal population,
unknown known 𝜎 2
3. Unknown
population
distribution, n large
4. Bernoulli population
dist. N large
Test statistic
𝑍=
Comparison to CI
𝜎
π‘₯ ± 𝑧𝛼
2 βˆšπ‘›
π‘‹Μ…βˆ’πœ‡0
𝜎/βˆšπ‘›
𝑋̅ βˆ’ πœ‡0
𝑆/βˆšπ‘›
𝑋̅ βˆ’ πœ‡0
𝑆/βˆšπ‘›
=𝑇
π‘₯ ± 𝑑𝛼,π‘›βˆ’1
=𝑇
π‘₯ ± 𝑧𝛼
𝑝̂ βˆ’ 𝑝0
βˆšπ‘0 (1 βˆ’ 𝑝0 )/βˆšπ‘›
𝜎 𝑖𝑠 π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘› 𝑠𝑑𝑑 π‘‘π‘’π‘£π‘Žπ‘‘π‘–π‘œπ‘›
𝑆 𝑖𝑠 π‘ π‘Žπ‘šπ‘π‘™π‘’ 𝑠𝑑𝑑 π‘‘π‘’π‘£π‘–π‘Žπ‘‘π‘–π‘œπ‘›
𝑒0 , 𝑝0 𝑖𝑠 π‘π‘œπ‘’π‘›π‘‘π‘Žπ‘–π‘Ÿπ‘¦ π‘π‘Žπ‘ π‘’
𝑛 𝑖𝑠 π‘ π‘Žπ‘šπ‘π‘™π‘’ 𝑠𝑖𝑧𝑒
𝑝̂ , 𝑋̅ 𝑖𝑠𝑒π‘₯𝑝𝑒𝑐𝑑𝑒𝑑 π‘£π‘Žπ‘™π‘’π‘’ π‘“π‘Ÿπ‘œπ‘š π‘ π‘Žπ‘šπ‘π‘™π‘’
2
2
𝑝̂ ± 𝑧𝛼
2
𝑆
βˆšπ‘›
𝑆
βˆšπ‘›
βˆšπ‘Μ‚ (1 βˆ’ 𝑝̂ )
βˆšπ‘›
5. In checking the reliability of a bank’s records, auditing firms sometime ask
a sample of the bank’s customers to confirm the accuracy of their savings account
balances as reported by the bank. The bank claims that the true fraction of accounts
on which there is disagreement is no more than 0.05. In a random sample of 400
customers
with savings accounts, 30 said that their balance disagreed with that reported
by the bank. Is there enough evidence to suggest that the claim of the bank (about
the true value of the fraction of accounts subject to disagreement) is not justified?
Modal: Bernoulli population dist, counting how many disagree
N is large 400>30
N=400
30
3
𝑝̂ = 400 = 40
𝐻1 : 𝑝 ≀ 0.05 𝑣𝑠 𝐻0 : 𝑝 > 0.05
𝑍=
𝑝̂ βˆ’ 𝑝0
βˆšπ‘0 (1 βˆ’ 𝑝0 )
βˆšπ‘›
=
𝑝̂ βˆ’ 0.05
√0.05 × 0.95
βˆšπ‘›
~𝑁(0,1)
CR is right tail
𝑒𝑠𝑒 𝛼 = 0.01
𝐢𝑅 = {𝑍 β‰₯ 𝑧𝛼 } = {𝑍 β‰₯ 𝑧0.01 } = {𝑍 β‰₯ 2.33}
π‘§π‘œπ‘π‘  =
𝑝̂ βˆ’ 0.05
√0.05 × 0.95
√400
π‘§π‘œπ‘π‘  𝑖𝑠 π‘›π‘œπ‘‘ 𝑖𝑛 𝐢𝑅 do not reject 𝐻0
=
30/400 βˆ’ 0.05
√0.05 × 0.95
√400
= 2.29
Conclusion: at 1% significance there is not enough evidence to suggest that the claim is
justified
Is this right?