Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
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?