0% found this document useful (0 votes)
10 views41 pages

Hypothesis Testing

The document provides an introduction to hypothesis testing, defining key concepts such as null and alternate hypotheses, test statistics, and types of errors (Type I and Type II). It outlines the process of hypothesis testing, including the formulation of hypotheses, significance levels, and the use of Z and T tests for different sample conditions. Various examples illustrate the application of these concepts in real-world scenarios.

Uploaded by

kjchauhan13
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)
10 views41 pages

Hypothesis Testing

The document provides an introduction to hypothesis testing, defining key concepts such as null and alternate hypotheses, test statistics, and types of errors (Type I and Type II). It outlines the process of hypothesis testing, including the formulation of hypotheses, significance levels, and the use of Z and T tests for different sample conditions. Various examples illustrate the application of these concepts in real-world scenarios.

Uploaded by

kjchauhan13
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/ 41

Probability and Statistics (MATH F113)

Hypothesis Testing

Himadri Mukherjee

Department of Mathematics
BITS PILANI K K Birla Goa Campus, Goa

January 31, 2023


Hypothesis testing introduction

A hypothesis is a statement about a population that can be tested


based on a sample evidence.
Null hypothesis, alternate hypothesis

Definition
A null hypothesis, Ho , is a hypothesis that is a prior belief. An
alternate hypothesis, Ha is a hypothesis that is contradictory to
the null hypothesis.
Acceptance and rejection of a hypothesis

Example 1. A person is suspected for a crime, what are the null


hypothesis and alternate hypothesis that the judge would consider?
Example 2.

Example 2. A medical test manufacturer claims that a new device


can detect the disease with 95 percent accuracy. What is the null
hypothesis for the buyer? What is the alternate hypothesis for the
buyer?
Example 3.

Example 3. A Sputnik claims that their vaccine has 90 percent


efficacy. A prospective buyer has to decide whether to buy the
vaccine. What is the null hypothesis for the prospective buyer?
Test statistic

Definition
A test statistics is a function of the sample data, which is used
to decide whether H0 should be rejected or not.
Hypothesis testing goals

The following is the payoff matrix of the situation,

H0 is true H0 is false
Accept H0 Correct decision Type-II error
Reject H0 Type-I error Correct decision
Errors in hypothesis testing

There are two types of possible errors in hypothesis testing namely,


• Type I error: rejection of the null hypothesis H0 when it is
actually true.
• Type II error: failure to reject the null hypothesis when it is
actually false.
P value

Definition
A p value for a test statistic is the probability of obtaining a
sample as contradictory to the null hypothesis as the sample
assuming the null hypothesis is true.
Significance level

A significance level is a threshold value α, such that if the p value


is less than α the null hypothesis is rejected.
what is significance level

Theorem
The probability of a Type-I error to take place is precisely the
significance level.

P ( type I error ) = P (H0 is rejected when it is true ) = α


Continued
Type II error

Theorem
The probability of committing a type-II error is denoted by β.

β = P (Type II error) = P (H0 is accepted when Ha is true )

The quantity 1 − β is also called the power of the test.


Critical or rejection region

Definition
A critical region or a rejection region is the value of the test
statistic for which the null hypothesis is rejected.
Example 4.

Example 4. A process for making steel pipe is under control if the


diameter of the pipe has a mean of 3.0000 inches with a standard
deviation of 0.025 inch. To check whether the process is under
control, a random sample of size n = 30 is taken each day and the
null hypothesis = 3.0000 is rejected if is less than 2.9960 or
greater than 3.0040. Find
• The probability of a Type I error
• The probability of a Type II error when = 3.0050 inches
Continued
Continued
Example 5.

Example 5. Suppose X has a Poisson distribution with parameter


λ = .1, to test H0 : λ = 0.1 against Ha : λ ≥ 0.1 the following
procedure is
Pused. A sample of size 20 is taken from X and H0 is
rejected if 20i=1 Xi ≥ 4. Find α, find β when λ = 0.2.
Continued
Example 6.

The calibration of a scale is to be checked by weighing a 10kg


weight 25 times. Suppose each trial are independent and normally
distributed with σ = .2kg.
• What is the null hypothesis
• With the sample mean as the test statistic, what is the p
value for for x = 9.85, what would you conclude at
significance level of .01?
• For a test with α = .01, what is the probability that
re-calibration is judged unnecessary when in fact
µ = 10.1, µ = 9.8?
Continued
Continued
The Z test

If the population in question is a normal population with known σ,


we can employ what is called the Z test. Let the null hypothesis
be H0 : µ = µ0 . We have the test statistic, Z = X−µ √ 0 following a
σ/ n
standard normal distribution.
• Ha : µ > µ0 , if P (Z ≥ z) < α, we reject else not rejected.
• Ha : µ < µ0 , if P (Z ≤ z) < α, we reject else not rejected.
• Ha : µ 6= µ0 , if P (|Z| ≥ |z|) < α, we reject else not rejected.
Example 7.

Example 7. Strength specifications of a certain product follows


normal distribution with µ = 4.5 and σ = 1.5, a new
manufacturing method to be tested for equal average strength. A
random sample of 29 such product gave average hardness 3.9,
what can we say about the null hypothesis. Assume the level of
significance to be 95 percent.
Continued
Example 8.

Example 8. Test the null hypothesis H0 : µ = 73.2 against the


alternate hypothesis Ha : µ > 73.2 where we have the following
data. Samples were drawn from normal population with mean 73.2
and standard deviation 8.6. 45 such samples gave a sample mean
of 76.7.
Continued
Large population, unknown standard deviation

In a large population with unknown σ, one can use the sample


standard deviation S to test the hypothesis. In this case the test
X−µ
statistic is replaced with Z = S/√ .
n
Example 9.
Theorem

Theorem
Let the population be a normal distribution with standard
deviation σ,
• H0 : µ = µ0 , Ha : µ 6= µ accept if (else reject)
 σ 
| X − µ0 |≤ zα/2 √
n
• H0 : µ ≤ µ0 , Ha : µ > µ0 , accept if (else reject)
 σ 
X − µ 0 ≤ zα √
n
• H0 : µ ≥ µ0 , Ha : µ < µ0 , accept if (else reject)
 σ 
X − µ0 ≥ −zα √
n
Continued

In the above theorem, if the sample is large (sample size more


than or equal to 30) and from a normal population with
unknown σ, one can substitute the sample standard deviation S in
place of σ.
Type two error
Continued
Continued
The t-Test

Recall for a (not large enough) sample from a normal population


X−µ
√ follows a T distribution of n − 1
with mean µ, the statistic S/ n
degree of freedom.
T distribution test

If the population in question is a normal population with unknown


σ, we can employ what is called the T test. Let the null hypothesis
be H0 : µ = µ0 . We have the test statistic, T = X−µ √ 0 following a
S/ n
T distribution with n − 1 degress of freedom.
• Ha : µ > µ0 , if P (T ≥ t) < α, we reject else not rejected.
• Ha : µ < µ0 , if P (T ≤ t) < α, we reject else not rejected.
• Ha : µ 6= µ0 , if P (|T | ≥ |t|) < α, we reject else not rejected.
Rejection region for T test
Example 9.

Example 9. Test run with 6 models of an experimental engine


showed that they operated for 24, 28, 21, 23, 32 and 22 minutes
with a gallon of a certain kind of fuel and is normally distributed.
If the probability of Type I error is 0.01, is this evidence against a
hypothesis that on the average this kind of engine will operate for
at least 29 minutes per gallon with this kind of fuel?
Continued
Summary of Hypothesis testing

• We formulate a null hypothesis and an appropriate alternative


hypothesis
• We specify the probability of a type I error; if possible, desired
or necessary we may also specify the probabilities of Type II
errors for particular alternatives.
• Based on the sampling distribution of an appropriate statistic,
we construct a criterion for testing the null hypothesis against
the given alternative.
• We calculate from the data the value of the statistic on which
the decision is to be based.
• We decide whether to reject the null hypothesis or whether to
fail to reject it.

You might also like