Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Lesson-4-Quantitative-Methods-with-Modeling-and-Simulation-Hypothesis-Testing

Hypothesis testing is a statistical method used to evaluate assumptions about a population based on sample data, involving the formulation of null and alternative hypotheses. It is essential for making informed decisions and avoiding errors, such as Type I and Type II errors, by providing a structured approach to data analysis. The process includes defining hypotheses, selecting significance levels, collecting data, calculating test statistics, and interpreting results to draw conclusions about the population.

Uploaded by

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

Lesson-4-Quantitative-Methods-with-Modeling-and-Simulation-Hypothesis-Testing

Hypothesis testing is a statistical method used to evaluate assumptions about a population based on sample data, involving the formulation of null and alternative hypotheses. It is essential for making informed decisions and avoiding errors, such as Type I and Type II errors, by providing a structured approach to data analysis. The process includes defining hypotheses, selecting significance levels, collecting data, calculating test statistics, and interpreting results to draw conclusions about the population.

Uploaded by

tamiskenneth
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Hypothesis Testing

Hypothesis Testing
Hypothesis testing is a structured
method used to determine if the findings of a
study provide evidence to support a specific
theory relevant to a larger population.
It is a type of statistical analysis in which
you put your assumptions about a population
parameter to the test. It is used to estimate
the relationship between 2 statistical
variables.
Hypothesis Testing
Let's discuss few examples of statistical hypothesis from
real-life
• A teacher assumes that 60% of his college's students come
from lower-middle-class families.
• A doctor believes that 3D (Diet, Dose, and Discipline) is
90% effective for diabetic patients.
Statistical analysts validate assumptions by collecting and
evaluating a representative sample from the data set under
study.
The process of hypothesis testing involves four key steps:
defining the hypotheses, developing a plan for analysis,
examining the sample data, and interpreting the final results.
Importance of Hypothesis Testing
in Data Analysis
Here is what makes hypothesis testing so important in data
analysis and why it is key to making better decisions:
Avoiding Misleading Conclusions (Type I and Type II Errors)
One of the biggest benefits of hypothesis testing is that it
helps you avoid jumping to the wrong conclusions. For instance,
a Type I error could occur if a company launches a new product
thinking it will be a hit, only to find out later that the data misled
them. A Type II error might happen when a company overlooks a
potentially successful product because their testing wasn’t
thorough enough. By setting up the right significance level and
carefully calculating the p-value, hypothesis testing minimizes
the chances of these errors, leading to more accurate results.
Making Smarter Choices
Hypothesis testing is key to making smarter,
evidence-based decisions. Let’s say a city planner
wants to determine if building a new park will increase
community engagement. By testing the hypothesis
using data from similar projects, they can make an
informed choice. Similarly, a teacher might use
hypothesis testing to see if a new teaching method
actually improves student performance. It’s about
taking the guesswork out of decisions and relying on
solid evidence instead.
Optimizing Business Tactics
In business, hypothesis testing is invaluable
for testing new ideas and strategies before fully
committing to them. For example, an e-commerce
company might want to test whether offering free
shipping increases sales. By using hypothesis
testing, they can compare sales data from
customers who received free shipping offers and
those who didn’t. This allows them to base their
business decisions on data, not hunches, reducing
the risk of costly mistakes.
Hypothesis Testing Formula:
z-test
Z = ( x̅ – μ) / (σ /√n)

Here,
x̅ is the sample mean,
μ is the population mean,
σ is the standard deviation,
n is the sample size.
How Hypothesis Testing
Works?
An analyst performs hypothesis testing on a statistical
sample to present evidence of the plausibility of the null
hypothesis. Measurements and analyses are conducted on a
random sample of the population to test a theory. Analysts use
a random population sample to test two hypotheses: the null
and alternative hypotheses.
The null hypothesis is typically an equality hypothesis
between population parameters; for example, a null hypothesis
may claim that the population means return equals zero. The
alternate hypothesis is essentially the inverse of the null
hypothesis (e.g., the population means the return is not equal
to zero). As a result, they are mutually exclusive, and only one
can be correct. One of the two possibilities, however, will
always be correct.
Null Hypothesis
and Alternative Hypothesis
The Null Hypothesis is the assumption that
the event will not occur. A null hypothesis has no
bearing on the study's outcome unless it is
rejected.
H0 is the symbol for it, and it is pronounced H-
naught.
The Alternate Hypothesis is the logical
opposite of the null hypothesis. The acceptance
of the alternative hypothesis follows the
rejection of the null hypothesis. H1 is the symbol
Example:

A sanitizer manufacturer claims that its product kills


95 percent of germs on average.
To put this company's claim to the test, create a null and
alternate hypothesis.
H0 (Null Hypothesis): Average = 95%.
Alternative Hypothesis (H1): The average is less than 95%.
Another straightforward example to understand this
concept is determining whether or not a coin is fair and
balanced. The null hypothesis states that the probability of
a show of heads is equal to the likelihood of a show of tails.
In contrast, the alternate theory states that the probability
of a show of heads and tails would be very different.
Hypothesis Testing Calculation With
Examples
Let's consider a hypothesis test for the average height of women
in the United States. Suppose our null hypothesis is that the average
height is 5'4". We gather a sample of 100 women and determine their
average height is 5'5". The standard deviation of population is 2.
To calculate, we would use the following formula:

z = ( x̅ – μ ) / (σ /√n)

z = (5'5" - 5'4") / (2" / √100)

z = 0.5 / (0.045)

z = 11.11
We will reject the null hypothesis as the result of 11.11 is very
large and conclude that there is evidence to suggest that the average
height of women in the US is greater than 5'4".
Steps in Hypothesis Testing
Hypothesis testing is a statistical method to determine if
there is enough evidence in a sample of data to infer that a
certain condition is true for the entire population. Here’s a
breakdown of the typical steps involved in hypothesis testing:
Formulate Hypotheses
Null Hypothesis (H0): This hypothesis states that there is no
effect or difference, and it is the hypothesis you attempt to
reject with your test.
Alternative Hypothesis (H1 or Ha): This hypothesis is what
you might believe to be true or hope to prove true. It is
usually considered the opposite of the null hypothesis.
Steps in Hypothesis Testing
Choose the Significance Level (α)
The significance level, often
denoted by alpha (α), is the probability
of rejecting the null hypothesis when it
is true. Common choices for α are 0.05
(5%), 0.01 (1%), and 0.10 (10%).
Steps in Hypothesis Testing
Select the Appropriate Test
Choose a statistical test based on the
type of data and the hypothesis.
Common tests include t-tests, chi-square
tests, ANOVA, and regression analysis.
The selection depends on data type,
distribution, sample size, and whether
the hypothesis is one-tailed or two-tailed.
Steps in Hypothesis Testing
Collect Data
Gather the data that will be
analyzed in the test. To infer
conclusions accurately, this data
should be representative of the
population.
Steps in Hypothesis Testing
Calculate the Test Statistic
Based on the collected data and
the chosen test, calculate a test
statistic that reflects how much the
observed data deviates from the
null hypothesis.
Steps in Hypothesis Testing
Determine the p-value
The p-value is the probability of
observing test results at least as
extreme as the results observed,
assuming the null hypothesis is correct.
It helps determine the strength of the
evidence against the null hypothesis.
Steps in Hypothesis Testing
Make a Decision
Compare the p-value to the chosen significance
level:

If the p-value ≤ α: Reject the null hypothesis,


suggesting sufficient evidence in the data supports
the alternative hypothesis.
If the p-value > α: Do not reject the null hypothesis,
suggesting insufficient evidence to support the
alternative hypothesis.
Types of Hypothesis Testing
1. Z Test
To determine whether a discovery or
relationship is statistically significant,
hypothesis testing uses a z-test. It usually
checks to see if two means are the same
(the null hypothesis). Only when the
population standard deviation is known and
the sample size is 30 data points or more,
can a z-test be applied.
Types of Hypothesis Testing
2. T Test
A statistical test called a t-test is
employed to compare the means of two
groups. To determine whether two
groups differ or if a procedure or
treatment affects the population of
interest, it is frequently used in
hypothesis testing.
Types of Hypothesis Testing
3. Chi-Square
You utilize a Chi-square test for hypothesis testing
concerning whether your data is as predicted. To
determine if the expected and observed results are
well-fitted, the Chi-square test analyzes the
differences between categorical variables from a
random sample. The test's fundamental premise is
that the observed values in your data should be
compared to the predicted values that would be
present if the null hypothesis were true.
Types of Hypothesis Testing
4. ANOVA
ANOVA, or Analysis of Variance, is a statistical method
used to compare the means of three or more groups.
It’s particularly useful when you want to see if there
are significant differences between multiple groups.
For instance, in business, a company might use ANOVA
to analyze whether three different stores are
performing differently in terms of sales. It’s also widely
used in fields like medical research and social sciences,
where comparing group differences can provide
valuable insights.
Example:
A company is claiming that their average
sales for this quarter are 1000 units. This
is an example of a simple hypothesis.

Suppose the company claims that the


sales are in the range of 900 to 1000
units. Then this is a case of a composite
hypothesis.
One-Tailed and Two-Tailed Hypothesis
Testing
The One-Tailed test, also called a directional test,
considers a critical region of data that would result in
the null hypothesis being rejected if the test sample
falls into it, inevitably meaning the acceptance of the
alternate hypothesis.
In a one-tailed test, the critical distribution area is one-
sided, meaning the test sample is either greater or
lesser than a specific value.
In two tails, the test sample is checked to be greater or
less than a range of values in a Two-Tailed test, implying
that the critical distribution area is two-sided.
If the sample falls within this range, the alternate
hypothesis will be accepted, and the null hypothesis will
be rejected.
Right Tailed Hypothesis Testing
If the larger than (>) sign appears in your hypothesis
statement, you are using a right-tailed test, also known
as an upper test. Or, to put it another way, the disparity
is to the right. For instance, you can contrast the battery
life before and after a change in production. Your
hypothesis statements can be the following if you want to
know if the battery life is longer than the original (let's
say 90 hours):
The null hypothesis is (H0 <= 90) or less change.
A possibility is that battery life has risen (H1) > 90.
The crucial point in this situation is that the alternate
hypothesis (H1), not the null hypothesis, decides whether
you get a right-tailed test.
Left Tailed Hypothesis Testing
Alternative hypotheses that assert the true value of a
parameter is lower than the null hypothesis are tested
with a left-tailed test; they are indicated by the less
than "<".
Example:
Suppose H0: mean = 50 and H1: mean not equal to 50
According to the H1, the mean can be greater than or
less than 50. This is an example of a Two-tailed test.
In a similar manner, if H0: mean >=50, then H1: mean
<50
Here the mean is less than 50. It is called a One-tailed
test.
Type 1 and Type 2 Error
A hypothesis test can result in two types of errors.

Type 1 Error: A Type-I error occurs when sample


results reject the null hypothesis despite being true.

Type 2 Error: A Type-II error occurs when the null


hypothesis is not rejected when it is false, unlike a
Type-I error.
Example:
Suppose a teacher evaluates the examination
paper to decide whether a student passes or fails.
H0: Student has passed
H1: Student has failed
Type I error will be the teacher failing the student
[rejects H0] although the student scored the
passing marks [H0 was true].
Type II error will be the case where the teacher
passes the student [do not reject H0] although
the student did not score the passing marks [H1 is
true].
Practice Problems on Hypothesis
Testing
Here are the practice problems on hypothesis testing that will help
you understand how to apply these concepts in real scenarios:
Question 1
A telecom service provider claims that customers spend an
average of ₹400 per month, with a standard deviation of ₹25.
However, a random sample of 50 customer bills shows a mean of
₹250 and a standard deviation of ₹15. Does this sample data
support the service provider’s claim?
Solution:
Null Hypothesis (H0): The average amount spent per month is
₹400.
Alternate Hypothesis (H1): The average amount spent per month
is not ₹400.
Given:
Population Standard Deviation (σ): ₹25
Sample Size (n): 50
Sample Mean (x̄): ₹250

1. Calculate the z-value:


z=x̄-/n
z=250-40025/50 −42.42

2. Compare with critical z-values: For a 5% significance


level, critical z-values are -1.96 and +1.96. Since -42.42 is
far outside this range, we reject the null hypothesis. The
sample data suggests that the average amount spent is
significantly different from ₹400.
Practice Problems on Hypothesis
Testing
Out of 850 customers, 400 made online grocery
purchases. Can we conclude that more than 50%
of customers are moving towards online grocery
shopping?
Solution:
Proportion of customers who shopped online (p):
400 / 850 = 0.47
Null Hypothesis (H0): The proportion of online
shoppers is 50% or more.
Alternate Hypothesis (H1): The proportion of
online shoppers is less than 50%.
Given:
Sample Size (n): 850
Significance Level (α): 5%
1. Calculate the z-value:

z=0.47-0.500.50.5/850 −1.74

2. Compare with the critical z-value: For a 5% significance


level (one-tailed test), the critical z-value is -1.645. Since -
1.74 is less than -1.645, we reject the null hypothesis. This
means the data does not support the idea that most
customers are moving towards online grocery shopping.
Practice Problems on Hypothesis
Testing
In a study of code quality, Team A has 250 errors in
1000 lines of code, and Team B has 300 errors in 800
lines of code. Can we say Team B performs worse than
Team A?
Solution:
Proportion of errors for Team A (pA): 250 / 1000 = 0.25
Proportion of errors for Team B (pB): 300 / 800 = 0.375
Null Hypothesis (H0): Team B’s error rate is less than or
equal to Team A’s.
Alternate Hypothesis (H1): Team B’s error rate is greater
than Team A’s.
What is hypothesis testing in statistics with
example?
Hypothesis testing is a statistical
method used to determine if there is
enough evidence in a sample data to draw
conclusions about a population. It involves
formulating two competing hypotheses, the
null hypothesis (H0) and the alternative
hypothesis (Ha), and then collecting data
to assess the evidence. An example:
testing if a new drug improves patient
recovery (Ha) compared to the standard
treatment (H0) based on collected patient
How do I interpret the results of a
hypothesis test?
Interpreting hypothesis test results
involves comparing the p-value to the
significance level (alpha). If the p-value
is less than or equal to alpha, you can
reject the null hypothesis, indicating
statistical significance. This suggests
that the observed effect is unlikely to
have occurred by chance, validating
your analysis findings.
Why is sample size important in hypothesis
testing?
Sample size is crucial in hypothesis
testing as it affects the test’s power. A
larger sample size increases the
likelihood of detecting a true effect,
reducing the risk of Type II errors.
Conversely, a small sample may lack
the statistical power needed to identify
differences, potentially leading to
inaccurate conclusions.
Can hypothesis testing be used for non-numerical
data?
Hypothesis testing can be applied to
non-numerical data through non-
parametric tests. These tests are ideal
when data doesn't meet parametric
assumptions or when dealing with
categorical data. Non-parametric tests,
like the Chi-square or Mann-Whitney U
test, provide robust methods for
analyzing non-numerical data and
drawing meaningful conclusions.
How do I choose the proper
hypothesis test?
Selecting the right hypothesis test
depends on several factors: the objective
of your analysis, the type of data
(numerical or categorical), and the sample
size. Consider whether you're comparing
means, proportions, or associations, and
whether your data follows a normal
distribution. The correct choice ensures
accurate results tailored to your research
question.

You might also like