0% found this document useful (0 votes)
35 views8 pages

Lecture Note 5

The document provides an overview of hypothesis testing in statistics, explaining the concepts of null and alternative hypotheses, test statistics, and critical regions. It outlines procedures for conducting tests involving one sample mean, two population means, and proportions, along with examples and exercises for practical application. The document emphasizes the importance of significance levels and the use of statistical tools to make informed conclusions based on sample evidence.

Uploaded by

Nadeeja
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)
35 views8 pages

Lecture Note 5

The document provides an overview of hypothesis testing in statistics, explaining the concepts of null and alternative hypotheses, test statistics, and critical regions. It outlines procedures for conducting tests involving one sample mean, two population means, and proportions, along with examples and exercises for practical application. The document emphasizes the importance of significance levels and the use of statistical tools to make informed conclusions based on sample evidence.

Uploaded by

Nadeeja
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/ 8

Hypothesis Testing

A statistical hypothesis is a claim about some unknown feature of the population.


Hypothesis testing is the procedure based on sample evidence and probability, used to test claims
regarding the characteristics of one or more populations.
Null and Alternative hypothesis
When making a statistical enquiry, we often use a hypothesis about a population parameter.
As an example, the mean height of 1st year students in University of Moratuwa is 1.65m. This
hypothesis is called the null hypothesis and denoted by 𝐻0 . This is assumed true until evidence
indicate otherwise.
In order to test the validity of 𝐻0 , we consider observations of random sample taken from
the population and perform a statistical test. If this test shows that we should reject 𝐻0 , we do so
in favor of an alternative hypothesis denoted by 𝐻1 .
Exercise:
Write down the null and alternative hypothesis.
a) The mean height of 1st year students in University of Moratuwa was 1.65m. A researcher
believes that the mean height has increased since then.
b) A bacteria percentage of water per 1ml was 2%. A scientist claim that this percentage is
different now.
There are several types of statistical test involving the normal distribution.
Test involving one sample mean – when 𝜎 2 is known.
Let there is a population which is normally distributed with known variance 𝜎 2 and test a
hypothesis about the population mean 𝜇 using a random sample of size 𝑛.
𝐻0 : The population mean is equal to 𝜇0 (𝜇 = 𝜇0 )
𝐻1 : The population mean does not equal to 𝜇0 (𝜇 ≠ 𝜇0 )
Then we test whether sample variable (𝑥̅ ), which is used to estimate population parameter is closed
to 𝜇. A statistical tool is used to test this is called as test statistic.
2 2
If 𝑋~𝑁(𝜇, 𝜎 2 ) and then 𝑋̅~𝑁(𝜇, 𝜎 ⁄𝑛). Assuming that 𝐻0 is true, 𝑋̅~𝑁(𝜇0 , 𝜎 ⁄𝑛).
➢ Note that if 𝑥 is normal 𝑥̅ can be directly standardized, because it is also distributed as
normal. But if 𝑥 is not normal, we can apply this technique only for large samples, because
for large samples 𝑥̅ is again distributed as normal. (By CLT).
Now we can standardize 𝑥̅ ,
𝑥̅ −𝜇
Test statistic (𝑍) = 𝜎 ~𝑁(0,1)
⁄ 𝑛

Critical Region: A set of values for test statistics which tells us to reject 𝐻0 .
Critical Value: The boundary of the critical region
Level of Significance (𝜶) = Critical value depends on a given probability which is considered as
the area of the critical region.
According to the alternative hypothesis each test can be divided into 3 parts.
Hypothesis Critical Region & Critical Value Rejection Criteria
𝐻0 : 𝜇 = 𝜇0 Reject 𝐻0 if test statistics
𝐻1 : 𝜇 ≠ 𝜇0 𝑍 < −𝑍𝛼⁄2 or 𝑍 > 𝑍𝛼⁄2
⇒Two tailed test (i.e. |𝑍| > 𝑍𝛼⁄2 )

𝐻0 : 𝜇 = 𝜇0 Reject 𝐻0 if test statistics


𝐻1 : 𝜇 < 𝜇0 𝑍 < −𝑍𝛼
⇒ One tailed test (Left)

𝐻0 : 𝜇 = 𝜇0 Reject 𝐻0 if test statistics


𝐻1 : 𝜇 > 𝜇0 𝑍 > 𝑍𝛼
⇒ One tailed test (Right)

Example: The length of metal bars produced by a particular machine are normally distributed with
mean length 420cm and standard deviation 12cm. The machine is serviced after which a sample
of 100 bars gave any other value as the mean length of 423cm. Is there any evidence at the 5%
level for a difference in the mean length of bars produced by the machine?
\
Procedure for carrying out a test
Step 1: State 𝐻0 and 𝐻1 and decide whether it is a one tailed or two tailed test.

Step 2: Consider the distribution of sample variable which is used to estimate the population
parameter under the assumption of 𝐻0 is true.

Step 3: Decide the level of significance

➢ Note that if 𝛼 is not given, normally we consider 𝛼 as 5%.


Step 4: Calculate the value of test statistic.
Assuming 𝐻0 is true,

Step 5: Decide the rejection criteria

Step 6: Make Conclusion


Scientific Conclusion:

General Conclusion:
Exercise: The weights of components produced by a certain machine are normally distributed with
mean weight 15.4g and standard deviation 23g. A random sample of 81 components has a mean
weight of 15g. Use this provided evidence at the 5% level of significance to test whether there is
a reduction in the mean weight of component produced by the machine. Assume that the standard
deviation remains the same.
Test involving one sample mean – when 𝜎 2 is unknown
2
Sampling distribution of mean 𝑋̅~𝑁 (𝜇, 𝜎 ⁄𝑛). But since 𝜎 2 is unknown, we use the
unbiased estimator 𝑠 2 (sample variance). Then the test statistic is,
𝑥̅ − 𝜇
𝑇=𝑠 ~𝑡𝑛−1
⁄ 𝑛

➢ Note that for large samples (𝑛 ≥ 30) distributions of 𝑥̅ can be considered as normal even
𝜎 2 is unknown. Then the test statistic,
𝑥̅ − 𝜇
𝑍=𝑠 ~𝑁(0,1)
⁄ 𝑛

Exercise: Five readings of the resistance in Ω of a piece of wire gave the following results
1.51 1.49 1.54 1.52 1.54
If the wire is pure silver its resistance should be 1.5Ω. If the wire is not pure then the resistance
can be increased. Test at 5% level the hypothesis that the wire is pure silver.
Comparing two population means
The objective of this section is testing the difference between two population means based
on means of two random samples. The all-possible hypothesis under two population mean
comparison can be listed as follows.
𝐻0 : 𝜇1 − 𝜇2 = 𝜇0 and 𝐻1 : 𝜇1 − 𝜇2 > 𝜇0
𝜇1 − 𝜇2 < 𝜇0
𝜇1 − 𝜇2 ≠ 𝜇0
There are two main cases have to be discussed here.
Case I – Unpaired case
Consider 𝑥1 ~𝑁(𝜇1 , 𝜎12 ) and 𝑥2 ~𝑁(𝜇2 , 𝜎22 ). Then sampling distributions of 𝑥̅ ′s is,
𝜎2 𝜎2 𝜎2 𝜎2
𝑥̅1 ~𝑁(𝜇1 , 1 ⁄𝑛1 ) and 𝑥̅2 ~𝑁(𝜇2 , 2 ⁄𝑛2 ). Now (𝑥̅1 − 𝑥̅2 )~𝑁(𝜇1 − 𝜇2 , 1 ⁄𝑛1 + 2 ⁄𝑛2 ).

Here also there are 3 sub cases to explain the test statistic for different conditions of population
variances.
• Sub case I: If 𝜎12 and 𝜎22 are known
(𝑥̅ 1 −𝑥̅ 2 )−(𝜇1 −𝜇2 )
Test statistic is 𝑍 = 2 2
~𝑁(0,1)
√𝜎1⁄𝑛 +𝜎2⁄𝑛
1 2

• Sub case II: If 𝜎12 = 𝜎22 = 𝜎 2 but 𝜎 2 is unknown

(𝑥̅ 1 −𝑥̅ 2 )−(𝜇1 −𝜇2 ) (𝑛1 −1)𝑠12 +(𝑛2 −1)𝑠22


Test statistic is 𝑇 = ~𝑡𝑣 ; where 𝑠𝑝 = √ and 𝑣 = 𝑛1 + 𝑛2 − 2
𝑛1 +𝑛2 −2
𝑠𝑝 √1⁄𝑛1 +1⁄𝑛2

• Sub case III: If 𝜎12 ≠ 𝜎22 and 𝜎12 , 𝜎22 are unknown
2
𝑠2 𝑠2
(( 1 ⁄𝑛1 )+( 2⁄𝑛2 ))
(𝑥̅ 1 −𝑥̅ 2 )−(𝜇1 −𝜇2 )
Test statistic is 𝑇 = 2 2
~𝑡𝑢 ; where 𝑢 = 2 2
√𝑠1⁄𝑛 +𝑠2⁄𝑛 𝑠2 𝑠2
( 1⁄𝑛1 ) ( 2⁄𝑛2 )
1 2
+
𝑛1 −1 𝑛2 −1

Exercise: The same test was given to a group of 100 scouts and 144 guides. The mean score for
scouts was 27.53 and the mean score for the guides was 26.81. Assuming a common population
standard deviation of 3.48, test 5%level of significance whether the scout’s performance in the test
was better than that of the guides.
Case II: Paired case
The objective of this is testing the difference between population means based on means
of two dependent random samples.
The matched sample design often leads to a smaller sampling error than the independent
sampling design. The key to analyzing a matched sample design is to use the difference data only.
Example: A matched sample design was used for two production methods. A sample of 6 workers
was taken, each worker performed the task for both production methods. The data on completion
time for the 6 workers are as follows.
worker Completion Time Difference in
completion time
Method 1 Method 2
1 6.0 5.4
2 5.0 5.2
3 7.0 6.5
4 6.2 5.9
5 6.0 6.0
6 6.4 5.8

Test whether there is a difference between the mean completion time.


Exercise: Six chickens were housed in two types of accommodation, each for a period of one
month. The number of eggs laid by each chicken in that time were as follows.
Chicken A B C D E F
Accommodation 1 16 14 18 15 16 12
Accommodation 2 18 15 15 14 19 15
Test the hypothesis that the type of accommodation 2 is better than the other.
Test involving one sample proportion
Let 𝑋 – number of successes and 𝑋~𝐵𝑖𝑛(𝑛, 𝑝). Then for large 𝑛, 𝑋~𝑁(𝑛𝑝, 𝑛𝑝𝑞) and,
𝑝𝑞
𝑝̂ ~𝑁(𝑝, 𝑛 ).
𝑝̂−𝑝0
Under 𝐻0 , where 𝐻0 : 𝑝 = 𝑝0 the test statistic 𝑍 = 𝑝 𝑞
~𝑁(0,1).
√ 0𝑛 0

Exercise: A college claims that it admits equal number of male and female students. A random
sample of 500 students at a college gave 267 males. Is there any evidence at 5% level of
significance that the college population is not evenly distributed into males and females?
Test involving two sample proportions
𝑝1 𝑞1
Here the main objective is to compare two population proportions. Let 𝑝̂1 ~𝑁(𝑝1 , ) and
𝑛1
𝑝2 𝑞2 𝑝1 𝑞1 𝑝2 𝑞2
𝑝̂2 ~𝑁(𝑝2 , ). Then, (𝑝̂1 − 𝑝̂ 2 )~𝑁(𝑝1 − 𝑝2 , + ).
𝑛2 𝑛1 𝑛2

The test statistic for this parameter can be discussed under two cases which are depends on the 𝐻0 .
• Case I: When 𝐻0 : 𝑝1 − 𝑝2 = 0
(𝑝̂1 −𝑝̂2 )−(𝑝1 −𝑝2 )
𝑍= 1 1
~𝑁(0,1)
√𝑝̂𝑞̂(𝑛 +𝑛 )
1 2

𝑥 𝑥 𝑥 +𝑥 𝑛1 𝑝̂1 +𝑛2 𝑝̂2


Where 𝑝̂1 = 𝑛1 and 𝑝̂2 = 𝑛2 . Therefore 𝑝̂ = 𝑛1 +𝑛2 =
1 2 1 2 𝑛1 +𝑛2

• Case II: When 𝐻0 : 𝑝1 − 𝑝2 = 𝐷 ; 𝐷 ≠ 0


(𝑝̂1 − 𝑝̂ 2 ) − (𝑝1 − 𝑝2 )
𝑍= ~𝑁(0,1)
𝑝̂ 𝑞̂ 𝑝̂ 𝑞̂
√ 1 1+ 2 2
𝑛1 𝑛2
For both cases sample must be sufficiently large.
Exercise: In the manufacturing process two different methods A and B were employed. To evaluate
both of manufacturing processers, the manager decided to examine the difference between them.
He took 3740 items from each process and 60 defectives were found in process A and 28 in process
B. Test at the 5% level of significance whether the process B is better than process A.
Testing a Variance
Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be a random sample of size 𝑛 from 𝑁(𝜇, 𝜎 2 ), assuming that 𝜇 is unknown.
Then we can use test statistic for the population variance,
(𝑛−1)𝑠2 2
𝑇= ~𝜒𝑛−1 .
𝜎2

Exercise: Test in Mr. Fernando’s past statistic classes has scores with standard deviation 14.1,
some of his current classes now has 25 test scores with a standard deviation of 9.3. Use 5% level
of significance to test the claim that his current class has less variance than past classes.
Testing a Comparison of Variance
Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be a random sample from 𝑁(𝜇1 , 𝜎12 ) and 𝑦1 , 𝑦2 , … , 𝑦𝑚 be a random sample from
𝑁(𝜇2 , 𝜎22 ). Then we can use test statistic to compare two population variances 𝜎12 and 𝜎22 ,
𝑠2 𝜎2
𝐹 = 𝑠12 𝜎22 .
2 1

Note: In the calculation of F-ratio say the sample variance belongs to the largest population
variance as the numerator. So that the F-ratio will always be greater than one.
For two tailed test – Get biggest sample variance as the numerator
𝑠2
For one tailed test – Under 𝐻1 , if 𝜎12 > 𝜎22 we expect 𝑠12 > 𝑠22 . Then 𝐹 = 𝑠12 .
2

Exercise: A random sample of size 10 was chosen from London-School children of the same age.
The heights (in cm) of the children chosen were,
Boys 142 125 127 122
Girls 130 122 117 125 123 121
Assuming that the heights are normally distributed, test whether variance of heights of boys is
higher than the variance of heights of girls at 5% level of significance.
Type I Error and Type II Error
In a statistical hypothesis test we reach one of four possible conclusions. Among these
conclusions there are two types of errors can be occurred.
Conclusion Hypothesis (𝐻0 )
True False
Accept 𝐻0 No error Type II error
Reject 𝐻0 Type I error No error

Then we can define


𝛼 = 𝑃(𝑇𝑦𝑝𝑒 𝐼 𝑒𝑟𝑟𝑜𝑟) = 𝑃(𝑟𝑒𝑗𝑒𝑐𝑡 𝐻0 |𝐻0 𝑖𝑠 𝑡𝑟𝑢𝑒 )
𝛽 = 𝑃(𝑇𝑦𝑝𝑒 𝐼𝐼 𝑒𝑟𝑟𝑜𝑟) = 𝑃(𝑎𝑐𝑐𝑒𝑝𝑡 𝐻0 |𝐻0 𝑖𝑠 𝑓𝑎𝑙𝑠𝑒 )
If we decide to accept 𝐻0 the only possible error is type II error. If we decide to reject 𝐻0
the only possible error is type I error. Thus, it is not possible that both types of errors can be
occurred simultaneously.
If we decrease 𝛼, 𝛽 will increase and if we increase 𝛼, 𝛽 will decrease. Therefore, it is very clear
that we cannot minimize both errors at once. Thus, we try to fix 𝛼 and try to find a test which
involve minimum 𝛽.
Power of the Test
1 − 𝛽 given as a percentage is called the power of the test. If 𝛽 close to zero, then the test is very
powerful.
Example: The ingredients of concrete are mix together to obtain mean breaking strength of 2000N.
If the mean breaking strength drop to 1800N. Then the composition must be change. The
distribution of breaking strength is distributed as normal with standard deviation of 200N. Samples
are taken in order to investigate the hypothesis 𝐻0 : 𝜇 = 2000𝑁; 𝐻1 : 𝜇 = 1800𝑁. Find the sample
size to test the above, when 𝑃[𝑇𝑦𝑝𝑒 𝐼 𝑒𝑟𝑟𝑜𝑟] = 0.05 and 𝑃[𝑇𝑦𝑝𝑒 𝐼𝐼 𝑒𝑟𝑟𝑜𝑟] = 0.1.

You might also like