0% found this document useful (0 votes)
51 views

4-CLT - Hypothesis Testing

- The central limit theorem states that the sampling distribution of the mean of any random variable will be normally distributed, even if the population is not normally distributed, as long as the sample size is sufficiently large. - Hypothesis testing involves formulating a null hypothesis (H0), which represents the current belief or status quo, and an alternative hypothesis (Ha), which represents what the researcher wants to prove or disprove. Type I and Type II errors can occur. - The document discusses sampling distributions, the central limit theorem, confidence intervals, hypothesis formulation and testing, and provides an example to illustrate these concepts.

Uploaded by

Rajeev Soni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

4-CLT - Hypothesis Testing

- The central limit theorem states that the sampling distribution of the mean of any random variable will be normally distributed, even if the population is not normally distributed, as long as the sample size is sufficiently large. - Hypothesis testing involves formulating a null hypothesis (H0), which represents the current belief or status quo, and an alternative hypothesis (Ha), which represents what the researcher wants to prove or disprove. Type I and Type II errors can occur. - The document discusses sampling distributions, the central limit theorem, confidence intervals, hypothesis formulation and testing, and provides an example to illustrate these concepts.

Uploaded by

Rajeev Soni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Central Limit Theorem and

Hypothesis Testing
Agenda
• Sampling distribution
• Central Limit Theorem
• Confidence intervals
• Hypothesis Formulation
• Null and Alternative Hypothesis
• Type I and Type II Errors
• Hypothesis Testing
• Example

2
Concepts of sampling distribution
• Why do we need sampling?
• Analyse the sample and make inferences about the
population
• Sample statistic vs population parameter
• Sampling distribution – distribution of a particular sample
statistic of all possible samples that can be drawn from a
population – sampling distribution of the mean

3
Sampling Distribution: CLT
• If n samples are drawn from a population that has a mean µ and standard deviation σ:
• The sampling distribution follows a normal distribution with:
• Mean: µ
• Standard Deviation: σ / √n (also c/a Standard Error)
• The corresponding z-score transformation is:

• If the population is normal, this holds true even for smaller sample sizes.
• However, if the population is not normal, this holds true for sufficiently large sample sizes.

4
Central Limit Theorem
• “Sampling Distribution of the mean of any independent random variable will be normal”
• This applies to both discrete and continuous distributions.
• The random variable should have a well defined mean and variance (standard deviation).
• Applicable even when the original variable is not normally distributed.

• Assumptions:
• The data must be randomly sampled.
• The samples values must be independent of each other.
• The 10% condition: When the sample is drawn without replacement, the sample size n, should be
no more than 10% of the population.
– In general, a sample size of 30 is considered sufficient.
• The sample size must be sufficiently large.
– If the population is skewed, pretty large sample size is needed.
– For a symmetric population, even small samples are acceptable.
5
Central Limit Theorem (contd.)
Assume a dice is rolled in sets of 4 trials and the faces are recorded. This is repeated for a month (30 days)
Sample Throw 1 Throw 2 Throw 3 Throw 4 Mean Sample Throw 1 Throw 2 Throw 3 Throw 4 Mean
1 4 1 6 2 3.25 16 6 4 5 5 5
2 1 2 3 2 2 17 3 2 3 6 3.5
3 5 6 4 6 5.25 18 1 3 2 1 1.75
4 4 3 6 1 3.5 19 6 1 3 3 3.25
5 2 2 4 3 2.75 20 5 2 5 6 4.5
6 4 2 1 6 3.25 21 1 2 1 6 2.5
7 3 6 6 4 4.75 22 3 2 6 2 3.25
8 2 4 2 5 3.25 23 3 1 3 4 2.75
9 2 1 5 6 3.5 24 3 2 6 4 3.75
10 1 3 6 6 4 25 6 1 1 5 3.25
11 4 3 3 3 3.25 26 1 5 2 2 2.5
12 6 5 4 1 4 27 4 2 2 3 2.75
13 3 3 3 1 3.25 28 4 6 2 5 4.25
14 2 5 2 6 3.75 29 4 2 3 5 3.5
15 1 3 1 6 2.75 30 3 1 4 1 2.25
6
Central Limit Theorem (contd.)
The means of the 30 samples are obtained are recorded in a frequency distribution table:

Mean 1.75 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5 5.25

Frequency 1 1 1 2 4 0 8 5 1 2 1 1 1 1 1

Plotting the sample distribution of the sample mean, the following curve is obtained:

7
Hypothesis

Hypothesis is an
assumption

Null hypothesis – is Alternate hypothesis


the status quo – – what a person
rejection leads to believes is true or
desired conclusion wants to prove
8
Hypothesis Formulation
Coca Cola’s most selling product is the 600ml coke or Coca Cola. Since the
600 ml info is on the label, we assume it to be true. But, is it actually true ?

As a customer, we’re concerned that there is at As a manufacturer, we would want the volume to be
least 600 ml in the bottle. If little more, we’re okay. exactly 600 ml.

On an average, is there Overfilling results in On an average, is there


Under-filling upsets the
at least 600 ml coke in higher costs of exactly 600 ml coke in
customers
every bottle? production. every bottle?

Quantity >= 600 ml Quantity = 600 ml


Quantity < 600 ml Quantity > 600 ml

9
Hypothesis Formulation (contd.)
This is the key to inferential
statistics: making inferences about
the population from the sample.

collect 100 bottles Measure volume of


Use sample mean to
from all over the each bottle in the
test assumption (status
country, so that we sample to find the
quo)
have a random sample. mean of 100 bottles.

What is status
Mean volume
quo in this
= 600ml
scenario
10
Hypothesis Formulation (contd.)
• Company claim: Volume > 600 ml (This may or may not be true)

What is the
Mean volume
claim or
> 600ml
assumption?

11
When formulating hypothesis…

Am I testing an
Am I testing a status
assumption or claim,
quo, that already
that is something
exists?
beyond what I know?

12
When formulating hypothesis…
Am I testing an
Am I testing a status
assumption or claim,
quo, that already
that is something
exists?
beyond what I know?

Alternate
Null hypothesis
hypothesis

Negation of the Research


research question to be
question proven

Always
Does not
Contains
contain equality
equality - =, <=,
- ≠, <, >
>=

13
Null and Alternative Hypothesis
All statistical conclusions are made in reference to the null hypothesis.
We either reject the null hypothesis or fail to reject the null hypothesis; we do not accept the null hypothesis.
From the start, we assume the null hypothesis to be true, later the assumption is rejected or we fail to reject it.
• When we reject the null hypothesis, we can conclude that the alternative hypothesis is supported.
• If we fail to reject the null hypothesis, it does not mean that we have proven the null hypothesis is true.
– Failure to reject the null hypothesis does not equate to proving that it is true.
– It just holds up our assumption or the status quo.

14
Type 1 & Type 2 errors

Ho True
Confidence level = Ho False
(Should not
1-α (Should reject)
reject) Power of the test
is its ability to
“Fail to reject” Ho
Reject Ho Type I Error (α) Correct decision when it is false

Power of the test =


Fail to Reject Ho Correct decision Type II Error (β) 1- β

17
Hypothesis testing roadmap
One sample 1-sample t-test
Population SD
known – Z test With equal
Continuous 2 samples variance
Population SD 2-sample t-test
(independent) Without equal
unknown – T-test
variance
Data type

2 samples
Paired t-test
(related)
More than 2
ANOVA
samples
One proportion
One sample
test

Categorical Two samples 2 proportion test

> 2 samples Chi-square test

18
Steps in hypothesis testing

Develop a clear
Gather sample data. Calculate test statistic.
research problem.

IF p is low,
NULL will GO
State the decision
Establish both null State statistical
rule: when to reject /
and alternate conclusion, based on
fail to reject null
hypothesis. the p-value
hypothesis.

Choose Type I error


Determine appropriate rate (α). This could be Make inference based
statistical test. assumed to be 0.05, on conclusion.
unless specified.

19
Type of hypothesis tests
• Single sample or two samples
• One tailed or two tailed
• Tests of mean, proportion or variance

20
One tailed vs two tailed test

Case 1 Case 2

• A customer complains that • Coca Cola official claims that


the mean volume is not the mean volume in coke
equal to 600 ml bottles is more than 600ml
• What is Ho? • What is Ho?
• What is Ha? • What is Ha?
• Is this one-tailed or two • Is this one-tailed or two
tailed? tailed?

21
One tailed vs two tailed test

Case 1 Case 2

•Ho: µ = 600ml •Ho: µ <= 600ml


•Ha: µ ≠ 600ml •Ha: µ > 600ml
•Two-tailed test •one-tailed test

22
One tailed vs two tailed test

n/a

=NORM.S.INV(0.975) =NORM.S.INV(0.95)

23
Confidence Intervals
• 95% of all sample means (x̅) are hypothesized to be in this region.
⇒ This is called as 95% confidence interval.

• If sample mean is in the blue region, we fail to reject the null hypothesis
• If sample mean is in the white region, we reject the null hypothesis.

• Here, α = 0.05
Critical Value
⇒ α is the level of significance or our tolerance level towards making a Type I error.

• If the null hypothesis is correct, (α * 100)% of the sample means should lie in the rejection region.

In case of one-tailed situation:


• All of α is in one tail or the other, depending on the alternative hypothesis.
• Ha points to the tail, where the critical value and the rejection region are.
(Case when observed mean > hypothesized mean)

24
Example – Confidence interval estimation
• A paper manufacturer has a production process that operates continuously. The
paper is expected to have a mean length of 11 inches and a standard deviation of
0.02 inches. At periodic intervals, a sample is selected to determine whether the
paper length is still equal to 11 inches. You select a random sample of 100 sheets
and the mean paper length is 10.998 inches.
• Construct a 95% confidence interval.
• Construct a 99% confidence interval.

25
Single Sample z – test of mean (known σ)
Test Statistic: z = x̅ - µ
σ/ √n

p-value: How much of the area is above the test-statistic? (Does test statistic fall in the rejection region?)
If it is less than the specific α, we reject the null hypothesis *Use NORM.S.DIST function

α = 0.10 α = 0.05 α = 0.01

26
Example problem - Single Sample z – test of mean
• You are the manager of a fast food restaurant. You want to determine if the
population mean waiting time has changed from the 4.5 minutes. You can
assume that the population standard deviation is 1.2 minutes. You select a
sample of 25 orders in an hour. Sample mean is 5.1 minutes. Use the relevant
hypothesis test to determine if the population mean has changed from the past
value of 4.5.

27
Steps to solve the problem…
• One-tailed or two-tailed
• What is Ho and Ha
• Determine Z and Zstat
• Draw the normal curve
• Reject/Fail to reject Ho?

28
Single Sample t – test of mean (unknown σ)
Test Statistic: t = x̅ - µ
s/ √n

p-value: How much of the area is above the test-statistic? (Does test statistic fall in the rejection region?)
If it is less than the specific α, we reject the null hypothesis *Use T.DIST function

* t-statistic depends on the sample size


α = 0.05

29
Two sample tests of mean
To understand if the mean volume in coke bottle is 600ml, we decide to take two samples
from two manufacturing centers.
The assumption would be that the mean difference between the two samples would be zero:
i.e. µ1 = µ2 => µ1 - µ2 = 0 (Null hypothesis)

• When σ is known, use z-distribution

Do : hypothesized mean b/w two means (zero in the above example)

• When σ is not known, use t-distribution

where, df is calculated as:

30
Example – 2 sample t-test of mean
• A hotel manager is concerned with increasing the return rate
of customers. One aspect that affects this is the time taken
to deliver to luggage to the guest’s room after check-in. A
random sample of 20 deliveries were selected from Wing A
and Wing B of the hotel. Analyse whether is a difference in
the average time taken by the 2 Wings?

31
Example -Paired t-test of mean
• The data in the file Concrete1.csv represents the
compressive strength of 40 samples taken 2 days and 7 days
after pouring.
– AT 0.01 level of significance, is there evidence that the mean
strength is lower at 2 days than at 7 days?

33
z-test of Proportion
In 2010, Coca Cola officials noted that 30% of the bottles were under-filled. They took corrective measures.
5 years later, they sampled 300 bottles and determined that 76 of them were under-filled.
At 5% significance level, is this evidence sufficient to show the impact of corrective measures?

Ho: po = 0.30
Ha: po < 0.30

̂p = 76/ 300

For one sample, For two samples,

p-value: How much of the area is above the test-statistic? (Does test statistic fall in the rejection region?)
If it is less than the specific α, we reject the null hypothesis *Use NORM.S.DIST function

34
Example – One tailed test of proportions
• There are 155 banks involved in certain international
transactions. A federal agency claims that at least 35% of
these banks have total assets of over $10 billion (In U.S.
dollars). An independent agency wants to test this claim. It
gets a random sample of 50 out of the 155 banks and finds
that 15 of them have total assets of over $10 billion. Can the
claim be rejected?

35
Test of variance
5 bottles from Manufacturer 1 show the following quantities:
• 607ml, 602ml, 590ml, 603ml, 598ml

5 bottles from Manufacturer 2 show the following quantities:


• 602ml, 597ml, 600ml, 603ml, 598ml

Case 1:
One of the two manufactures contract should be renewed at the end of the year.
Which one do you think should be renewed ? First, second or both ?

Case 2:
The audit teams wants to ensure that the production patterns should same remain equivalent across all manufactures.
Do you think the two manufactures qualify this constraint ?

36
Chi square test of variance
When we take many samples of the same size from a normal population and find the sample means, they follow a
normal distribution.

When we take many samples of the same size from a normal population and find the sample variances, they DO NOT
follow a normal distribution; instead they follow a chi-square (χ2) distribution , which is dependent on the degrees
of freedom.

• Area under the curve is always 1.


• Cumulative Probability runs from right to left; 1 is towards the left end, while 0 is towards the right.

37
Chi square test of variance
Chi-square (χ2) test compares the population variance, with the hypothesized variance.

χ2 = (n-1) s2 where, n = sample size


σ2 s2 = sample variance and σ2 = population variance (which we wish to test)

At α = 0.05 and n = 5 (df = 4)

p-value: How much of the area is above the test-statistic? (Does test statistic fall in the rejection region?)
If it is less than the specific α, we reject the null hypothesis *Use CHISQ.DIST function

38
Example – chi-squared test
• When new paperback novels are promoted at bookstores, a display is often
arranged with copies of the same book with differently colored covers. A
publishing house wanted to find out whether there is a dependence between the
place where the book is sold and the color of its cover. For one of its latest
novels, the publisher sent displays and a supply of copies of the novels to large
bookstores in five major cities. The resulting sales of the novel for each city-color
combination are as follows. Numbers are in thousands of copies sold over a
three-month period.

39
F-ratio test of variance
When two independent random samples are taken from normal population(s) with equal variances, the sampling
distribution of the ratio of those sample variances follows an F distribution.
• Test of equality of variances: comparison of two sample variances
• The variances are compared using a ratio:
F = s2x where, s2x is the larger sample variance while s2y is the smaller sample variance
s2y (Both numerator and denominator have their individual dfs)

F- distribution is only right-tailed:


Ho: σ2x = σ2y Ha: σ2x != σ2y

For α = 0.05 and df1 = 24, df2 = 21

p-value: How much of the area is above the test-statistic? (Does test statistic fall in the rejection region?)
If it is less than the specific α, we reject the null hypothesis *Use F.DIST function

40
Example - F-test
• An important measure of the risk associated with a stock is
the standard deviation, or variance, of the stock's price
movements. A financial analyst wants to test the one-tailed
hypothesis that stock A has a greater risk (larger variance of
price) than stock B. A random sample of 25 daily prices of
stock A gives s2A=6.52, and a random sample of 22 daily
prices of stock B gives a sample variance of s2B=3.47. Carry
out the test at α=0.01.

41
Hypothesis Testing Using Python

One Sample Testing


Some important functions:
1. t_statistic, p_value = ttest_1samp(array, n)
Here n= sample number , daily_intake= array
2. z_statistic, p_value = wilcoxon(array – n)
Hypothesis Testing Using Python

Two Sample Testing


Some important functions:
1. t_statistic, p_value = ttest_ind(group1, group2)
2. u, p_value = mannwhitneyu(group1, group2)
3. t_statistic, p_value = ttest_1samp(post-pre, 0)
4. z_statistic, p_value = wilcoxon(post-pre)
5. levene(pre,post)
6. shapiro(post)
Titan Insurance Case Example

45
Test to determine whether new scheme has significantly raised outputs

• Is the new scheme better than the old scheme


• Based on the sales before and after the scheme
• Sample size N=30
• Population SD is unknown

Right Tailed Paired T-test

46
Null & Alternate hypothesis
• Ho: There is no significant difference between the mean of
the Sales output before and after introduction of the new
incentive scheme
• Ha: The mean of the Sales output after implementation of
the new scheme is greater than that of the old scheme
• H0: μnew = μold
• H1: μnew > μold

47
T-test results

48
Inference from the t-test

Statistical inference Practical inference

oAs the p-value (0.06529) oThere is no significant


from the t-test is higher increase in the average
than the significance level Sales Output due to the
of 0.05, we fail to reject implementation of the
the null hypothesis. new incentive scheme.
• μnew = μold

49
Interesting decision trees for different tests

It can be helpful
in deciding what
to use where.

Image link- https://i.pinimg.com/originals/43/8e/75/438e752694f5738971efb00f595c344c.png


55
Questions?
56

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