0% found this document useful (0 votes)
170 views33 pages

04 Hypothesis Testing IITB PDF

The document discusses statistical hypothesis testing and how it can help determine if a measured value is within expected variation or not. It provides an example of using blood platelet count to determine if a patient has a disease. The key steps in hypothesis testing are outlined, including defining the null and alternative hypotheses, choosing a significance level, computing a test statistic, and determining whether to reject or accept the null hypothesis based on the critical region or p-value. Type I and Type II errors are also explained. The document emphasizes that hypothesis testing is used to make data-driven decisions in many fields when some uncertainty is involved.

Uploaded by

Ninad Kale
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)
170 views33 pages

04 Hypothesis Testing IITB PDF

The document discusses statistical hypothesis testing and how it can help determine if a measured value is within expected variation or not. It provides an example of using blood platelet count to determine if a patient has a disease. The key steps in hypothesis testing are outlined, including defining the null and alternative hypotheses, choosing a significance level, computing a test statistic, and determining whether to reject or accept the null hypothesis based on the critical region or p-value. Type I and Type II errors are also explained. The document emphasizes that hypothesis testing is used to make data-driven decisions in many fields when some uncertainty is involved.

Uploaded by

Ninad Kale
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/ 33

Testing of Hypotheses

Dr. Vinay Kulkarni


Background
• Random variables
– Their measurements show variations
– For no reasons at all
• We are interested in
– Expected Values of random variables
– But, we may get value “off” from the expected value
– In such situations, how to decide if the value is:
• Within the expected / permissible deviation from the mean?
• Such situations are encountered
– While taking many decisions

2
Example
• Based on a study, it has been established that:
– On an average, blood platelet count lower than 75000
is indicative of a certain disease
• When a patient reports a blood count of 60000
– Should the doctor start treating the patient?

3
Example
• Based on a study, it has been established that:
– On an average, blood platelet count lower than 75000
is indicative of a certain disease
• When a patient reports a blood count of 60000
– Should the doctor start treating the patient?
• Questions:
– Is this value within expected variations?
– Or is it not?
– Are there any statistical tests that can help decide?

4
Statistical Hypothesis
• Statistical Hypothesis
– An assumption or a statement
– About one or two parameters
– Involving one or more populations
– May or may not be true
• Testing of Hypotheses
– Based on data samples
– Decide whether the hypothesis is true / false
• Example:
– Hypothesis: The patient is suffering from the disease
– Hypothesis: platelet count < 75000
5
The method of statistical hypotheses
• First of all we assume some hypothesis is correct
– (Not necessarily the one we believe to be true!)
– Example: The patient is not suffering from the disease
• Hypothesis: Platelet count is actually >= 75000
• This is known as the NULL hypothesis: H0
• We have to prove that the platelet count is – beyond doubt –
not a random variation of the real value.
• We then carry out a test
– The goal is to check if the result of the test is beyond
the limits of believability
– If it is, we have to reject our hypothesis.

6
Fundamental Concepts: Hypotheses Testing
• The Null and alternate • The Test Statistic
hypothesis – Numerical value of the test
statistic leads us to make the
– H0 = Null hypothesis decision
– H1 = Alternate • The Critical Region (CR) or the
hypothesis Rejection Region (RR)
– An interval determined by the
• Possible Decisions selection of appropriate
– Reject the Null distributions
hypothesis – Determines the region related to
the test statistic and used to
• This is the Goal: to prove decide the acceptance / rejection
with high probability of hypotheses
– Do not reject the Null • Conclusion and interpretation
hypothesis

7
The NULL hypothesis: H0
• We choose the NULL hypothesis H0 to be specific enough
and simple enough that we can actually compute the
likelihood of any given outcome of our observations
• NULL hypothesis is something that the data is likely to
reject
– Example:
• Assume : Average mean temperature is 98
• A sample measurement : 99
– Data indicates: Observed temperature is not normal
– Hypothesis H0 should be “Observed temperature is Normal”

8
The “alternate” hypothesis: H1
• The alternate hypothesis is something that we keep in
mind, and it is something that we would like to accept in
case the null hypothesis gets rejected.
• The alternate hypothesis is usually something that the
data will support.

• In our example:
– H1 : “Temperature is Not normal”

9
Stating the Hypothesis
Stating H0 and H1
1. Two tailed test
• H0 : P = P0 versus H1 : P  P0

2. Left tailed test


• H0 : P  P0 versus H1 : P < P0

3. Right tailed test


• H0 : P  P0 versus H1 : P > P0

10
Outcome of Hypothesis Testing
• NULL hypothesis is rejected & Alternate
hypothesis is accepted

OR

• NULL hypothesis is accepted & Alternate


hypothesis is rejected

11
Type I Error
• Consider the following situation:
– We reject the null hypothesis
– However, in reality, the null hypothesis is indeed true
– Therefore, we have rejected the null hypothesis, when,
in reality it is true
– This is called a TYPE I ERROR
• TYPE I errors  False positives
• Probability of Type I error = α (the confidence level)
– Also known as “level of significance”
• Example: A healthy person is considered sick …
12
Type I Error

Most common values for α


• 0.01, 0.05, 0.1
• Corresponding with 99%, 95% and 90%
confidence levels

13
Type II Error
• Type II Error
– Failing to reject the NULL hypothesis even when in
reality it is false
• Probability of Type II Error: β
– It is very difficult to calculate this probability
– It depends on a variety of unknown parameters

14
Type I and Type II errors
• We would like to reduce both types of errors
• However, when we reduce probability of Type I
error we increase the probability of Type II error
– By making the test more stringent, we reduce the risk
of falsely rejecting the null hypothesis BUT increase
the risk of failing to reject it when we should
• That’s why the de facto value of 0.05 is so popular
• Note:
– Selecting a larger sample size minimizes both types of
errors

15
Size and Power of a test
• The size of a test is given by
α
• Power of a test is given by
(1 – β)
• Ideal we want our test to have:
– Low size AND
– High power
• The practice of computing the power of a test is
known as
– Power Analysis
16
Hypothesis Testing: Types
• About one parameter
– One proportion
– One mean
– One standard deviation
• About two parameters
– Two proportions
– Two means
– Two standard deviations

17
Steps in Hypotheses Testing
Classical Method
1. Determine and state H0 and H1
2. Decide the significance level  and the critical
region
3. Based on the parameter, choose the test statistic
4. Using available data compute the test statistic
5. Make the statistical Accept or Reject decision
based on
a) Computed value of the test statistic
b) The critical region identified in step 2

18
Hypothesis Testing about one proportion
• Characteristics of the proportion
– Best estimate
– Standard deviation
– Conditions
• The sample is a simple random sample
• Sample values are independent of each other
• np(1-p)  10

19
Confidence levels and Critical Regions
• The most used values for  are
– 0.01, 0.05, 0.1
– Distribution relevant to proportions

• Test statistic for proportions

20
Example / Exercise
• Known from past surveys
– 35% of country’s citizens invest abroad
• Current Survey
– 800 adults were surveyed
– 320 were found to hold foreign assets
• Government wants to know
– If the foreign investment is still > 35%
– With 10% significance level

21
Solution (Classic Method)
• H0 : P <= 0.35 versus H1 : P > 0.35
– Right tailed test
• Significance level 10% = 0.1
• Z value associated with 0.1 = 1.28 (Normal Dist)
• Test to be done is as follows:
– Since it is right tailed test
– Hypothesis H0 can be accepted if calculated Z value is <= 1.28
(rejection region Z > 1.28)
• Calculated Z value
– = 2.965

– Since Zcal > 1.28, Hypothesis is rejected


• Result: Foreign investment still exceeds 35%

22
The p-value
• The computed probability of getting the observed
result, or any result at least as extreme in its
difference from what the null hypothesis would
imply – is called the p-value
• A p-value of 0.05 is the de facto standard cut-off
between significant and non-significant results
• If this de facto value is used as the critical value, it
will result in wrong results 5% of the time

23
Steps in Hypotheses Testing: p-value method
p-value method
1. Determine and state H0 and H1
2. Decide the significance level 
3. Based on the parameter, choose the test statistic
4. Using available data compute the test statistic and
the p-value
• How to calculate p-value?
5. Make the statistical Accept or Reject decision based
on
•  and p-value
a) p-value less than  should reject H0
b) p-value greater than  should not reject H0

24
Solution: p-value method
• For two tailed tests
– P-value = 2 * P(Z < Zcal)
• For Left-tailed tests
– P-value = P(Z < Zcal)
• For Right-tailed tests
– P-value = P(Z > Zcal)

• In all these cases, if the computed p-value is <


significance level  the hypothesis is rejected
– Else, hypothesis is not rejected
25
Solution Based on p-value
• H0 : P <= 0.35 versus H1 : P > 0.35
– Right tailed test
• Significance level 10% = 0.1
• Calculated Z value
– = 2.965

– From the Normal tables 2.965 corresponds to 0.99848


• P(Z > Zcal) = 1 – 0.99850 = 0.0015
• P(Z > Zcal) = 0.0015 < significance level 0.1
– Therefore hypothesis P <= 0.35 is rejected
• Result: Foreign investment still exceeds 35%

26
Hypothesis testing : Single Parameter
• The Mean, when variance is known
– Test statistic
• The Mean, when variance is unknown
– Large sample size (normal dist)

– Small sample size (t-distribution)


• The Variance
– Test statistic (chi-squared)
• The Proportion
– Test statistic
27
Exercise: 1
• In a medical test, rats were subjected to unit dose
of a drug and recording their response times.
Based on prior studies, it is known that the rats
with no drugs given have a mean response time of
1.2 seconds. The new studies, after drugs,
involving 100 rats throw up a mean response time
of 1.05 seconds with a standard deviation of 0.5
seconds. Can we conclude that the drug has any
effect on the response time? (Level of significance
0.01)

28
Solution: 1
• mu = 1.2 • Data indicates: reduction in time
• xbar = 1.05 • H0 : No change in mean time
• n = 100 • H1 : Change in mean time
• s = 0.5s
• Since we are testing equality, test is two tailed
• Since n > 30, normal distribution assumed
• At 0.01 significance levels, the z limits are
• 0.005 and 0.995
• z0.005 = -2.576 and z0.995 = 2.576
• Calculated z = (xbar – mu)/(s/sqrt(n)) = -3
• Since -3 is less than -2.576, it lies in REJECTION region.
• Therefore H0 is REJECTED and H1 is accepted
– Mean response time has changed from 1.2 seconds with the introduction
of the drug
• p-value method
– Calculated p-value: pnorm(-3) = -0.00135
– Since |-0.00135| < 0.01 (significance) p-value is less than significance.
Therefore, H0 is rejected & H1 accepted
29
Problem 2
• A major car manufacturer wants to test a new engine
to determine whether it meets new air-pollution
standards.
• The mean emission m of all engines must be less than
20 parts per million of carbon.
• Ten engines are manufactured for testing purposes
and the emission level of each is determined to be:
15.6 16.2 22.2 20.5 16.4 19.4 16.6 17.9 12.7 13.9.
• Does the data supply sufficient evidence to allow the
manufacturer to conclude this type of engine meet
the pollution standard?
– Test the hypothesis at a level a = 0.01.

30
Solution: 2
• n = 10 • Data indicates: emission < 20 ppm (xbar = 17.14)
• xbar = 17.14 • H0 : emission >= 20 ppm
• s = 2.9228 • H1 : emission < 20 ppm
• alpha = 0.01

• Since we are testing inequality (>=), the test is left tailed


• Since n < 30, t-distribution assumed with dof = 10-1 = 9
• At 0.01 significance levels, the t limit is:
– t0.01 = qt(0.01) = -2.82
• Calculated t = (17.14 - 20)/(2.9228/sqrt(10)) = -3.09
• Since -3.09 is less than -2.82, it lies in REJECTION region.
• Therefore H0 is REJECTED and H1 is accepted
– Emission is < 20 ppm
• p-value method
– Calculated p-value: pt(-3.09) = 0.006467
– Since 0.006467 < 0.01 (significance level) p-value is less than
significance level. Therefore, H0 is rejected & H1 accepted

31
Problem 3
• The National Science foundation, in a survey of
2237 engineering graduate students who earned
PhD degrees, found that 607 were US citizens; the
majority (1630) of the PhD degrees were awarded
to foreign nationals. Conduct a test to determine
whether the true percentage of PhD degrees
awarded to foreign nationals exceeds 50% at a
level a = 0.01.

32
Solution: 3
• n = 2237 • Data indicates: pcap > 0.5 (0.729)
• pcap = 1630/2237 = 0.729 • H0 : Proportion of degree to foreigners <= 0.5
• p0 = 0.5 • H1 : Proportion of degree to foreigners > 0.5
• alpha = 0.01

• Since we are testing inequality (<=), the test is right tailed


• Since n > 30, normal distribution assumed
• At 0.01 significance levels, the z limit (for right tailed region) is:
– z(1-0.01) = z(1-0.01) = qnorm(0.99) = 2.3263
• Calculated z = (0.729 – 0.5)/sqrt(0.729 * (1-0.729)/2237) = 24.37
• Since 24.37 is greater than 2.3263, it lies in REJECTION region.
• Therefore H0 is REJECTED and H1 is accepted
– Therefore: Proportion of degree to foreigners > 0.5
• p-value method
– Calculated p-value: 1-pnorm(24.37) which is approximately “0”
– Since p-value is less than significance level, therefore, H0 is rejected & H1
accepted
33

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy