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

ML Case Study

This document describes hypothesis testing, which is a statistical method used to draw inferences about populations based on sample data. It involves formulating a null hypothesis (H0) of no effect or relationship and an alternative hypothesis (H1) of an effect or relationship. A test statistic is calculated from sample data and compared to a critical value determined by the significance level (α) to calculate a p-value. The p-value is then used to either reject or fail to reject the null hypothesis, allowing conclusions to be drawn about the population. The key steps are formulating hypotheses, collecting sample data, choosing a significance level, performing a statistical test to get test statistics and p-values, making a decision to reject or fail to

Uploaded by

Jaanhvi Singh
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)
36 views

ML Case Study

This document describes hypothesis testing, which is a statistical method used to draw inferences about populations based on sample data. It involves formulating a null hypothesis (H0) of no effect or relationship and an alternative hypothesis (H1) of an effect or relationship. A test statistic is calculated from sample data and compared to a critical value determined by the significance level (α) to calculate a p-value. The p-value is then used to either reject or fail to reject the null hypothesis, allowing conclusions to be drawn about the population. The key steps are formulating hypotheses, collecting sample data, choosing a significance level, performing a statistical test to get test statistics and p-values, making a decision to reject or fail to

Uploaded by

Jaanhvi Singh
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/ 21

“HYPOTHESIS TESTING”

submitted in partial fulfilment of the requirements of the degree of

BACHELOR OF ENGINEERING
in
INFORMATION TECHNOLOGY
In (A.Y 2023-2024)
by

31-BE-IT-B-Akash Singh

32-BE-IT-B-Avinash Singh

33-BE-IT-B-Ekta Singh

34-BE-IT-B-Jaanhvi Singh

35-BE-IT-B-Khushi Singh

36-BE-IT-B-Reeshu Singh

37-BE-IT-B-Rishabh Singh

38-BE-IT-B-Rishabh Singh

39-BE-IT-B-Ritesh Singh

40-BE-IT-B-Yuvraj Singh

Under the Guidance of

Mrs. Pranjali Kasture


Assistant Professor, Department of Information Technology Engineering, TCET

Choice-Based Credit Grading System with Holistic Student Development


(CBCGS-H 2020)
CERTIFICATE

This is to certify that Mr. Akash Singh, Mr. Avinash Singh, Ms. Ekta Singh, Ms. Jaanhvi
Singh, Ms. Khushi Singh, Mr. Reeshu Singh, Mr. Rishabh Singh, Mr. Rishabh Singh, Mr.
Ritesh Singh, Mr. Yuvraj Singh are Bonafede students of Information Technology
Department, Thakur College of Engineering and Technology, Mumbai. They have
satisfactorily completed the requirements of Machine Learning for IT Application
Development-Innovative Examination and In Semester Examination as prescribed by Thakur
College of Engineering and Technology (An Autonomous College affiliated with the
University of Mumbai) while working on “Hypothesis Testing”.

Signature:___________________ Signature:___________________

Name: Mrs. Pranjali Kasture Name: Mr. Rajesh Bansode

Assistant Professor, IT I/C HOD- IT


ACKNOWLEDGEMENT
We would like to express our gratitude and appreciation to our project in-charge for her
invaluable guidance, support, and encouragement throughout this project. Her unwavering
dedication and expertise have been instrumental in shaping this project and ensuring its
success. We would also like to acknowledge the contribution of my colleagues and
collaborators, whose expertise and insights have been invaluable in developing and
implementing the visualization of various sorting algorithms. Furthermore, we would like
to express our gratitude to all the participants who participated in the user study and
provided their valuable feedback, which helped improve the project.

[1]. Akash Singh (Roll No. 31) ___________________

[2]. Avinash Singh (Roll No. 32) ___________________

[3]. Ekta Singh (Roll No. 33) ___________________

[4]. Jaanhvi Singh (Roll No. 34) ___________________

[5]. Khushi Singh (Roll No. 35) ___________________

[6]. Reeshu Singh (Roll No. 36) ___________________

[7]. Rishabh Singh (Roll No. 37) ___________________

[8]. Rishabh Singh (Roll No. 38) ___________________

[9]. Ritesh Singh (Roll No. 39) ___________________

[10]. Yuvraj Singh (Roll No. 40) ___________________


Hypothesis testing

Abstract:-
Hypothesis testing is a foundational statistical method used to draw meaningful inferences about
populations based on sample data. This technique involves the formulation and comparison of two
hypotheses: the null hypothesis (H0), which posits no significant effect or relationship, and the alternative
hypothesis (H1 or Ha), which suggests the presence of such an effect or relationship. Through the
calculation of a test statistic and the determination of a significance level (α), researchers assess the
strength of evidence against the null hypothesis and make informed decisions.
The process begins with formulating the hypotheses and collecting sample data, followed by the
computation of a test statistic that quantifies the observed sample's deviation from the null hypothesis's
assumed parameters. The calculated test statistic is then compared to a critical value determined by the
chosen significance level, resulting in the calculation of a p-value. This p-value represents the probability
of observing a test statistic as extreme as the calculated one, assuming the null hypothesis is true.
Researchers interpret the p-value in relation to the chosen significance level. If the p-value is smaller than
the significance level, the null hypothesis is rejected, and the alternative hypothesis is supported.
Conversely, if the p-value exceeds the significance level, there is insufficient evidence to reject the null
hypothesis.
Hypothesis testing aids in making objective decisions based on empirical data, contributing to the
validation or rejection of research hypotheses. However, researchers should exercise caution in
interpreting results, as hypothesis testing does not prove the truth of hypotheses but rather assesses the
likelihood of observed outcomes under different assumptions. As an indispensable tool in scientific
inquiry, hypothesis testing facilitates the advancement of knowledge across various disciplines by
enabling evidence-based conclusions and fostering a deeper understanding of underlying relationships
and effects.

Introduction: -

What is hypothesis testing?


Hypothesis testing is a form of statistical inference that uses data from a sample to draw conclusions about
a population parameter or a population probability distribution. First, a tentative assumption is made about
the parameter or distribution. This assumption is called the null hypothesis and is denoted by H0.
An alternative hypothesis (denoted Ha), which is the opposite of what is stated in the null hypothesis, is
then defined. The hypothesis-testing procedure involves using sample data to determine whether or
not H0 can be rejected. If H0 is rejected, the statistical conclusion is that the alternative hypothesis Ha is
true.
Here's a breakdown of the key components of hypothesis testing:

1. Null Hypothesis (H0): The null hypothesis is the default or initial assumption that there is no
significant effect or relationship in the population. It represents a statement of no effect, no difference, or
no change.

2. Alternative Hypothesis (H1 or Ha): The alternative hypothesis is what researchers are trying to find
evidence for. It represents the presence of a significant effect, difference, or change in the population.

3. Test Statistic: A test statistic is a numerical value calculated from the sample data that helps quantify
the difference between the sample and the population parameters assumed by the null hypothesis.

4. Significance Level (α): significance level, often denoted as α (alpha), is a predetermined threshold that
helps determine the level of evidence required to reject the null hypothesis. Common choices for α include
0.05 and 0.01.

5. P-value: The p-value is a measure of the evidence against the null hypothesis. It represents the
probability of obtaining a test statistic as extreme as, or more extreme than, the one observed in the
sample, assuming that the null hypothesis is true. A low p-value (typically less than the chosen
significance level) suggests that the data provides strong evidence against the null hypothesis.

6. Decision Rule: Based on the p-value and the chosen significance level, researchers decide whether to
reject the null hypothesis. If the p-value is less than or equal to the significance level, the null hypothesis
is rejected in favor of the alternative hypothesis. If the p-value is greater than the significance level, there
is not enough evidence to reject the null hypothesis.

7. Conclusion: The conclusion of a hypothesis test states whether the null hypothesis is rejected or not. It
also interprets the results in the context of the research question.

Steps involved in Hypothesis testing


Hypothesis testing is a statistical method used to make inferences or draw conclusions about a population
based on a sample of data. It is a fundamental concept in statistics and is widely used in various fields,
including science, social sciences, economics, and more.

The process of hypothesis testing involves the following steps:

1. Formulating Hypotheses:
- Null Hypothesis (H0): This is the default assumption or statement that there is no significant difference
or effect. It is often denoted by H0.
- Alternative Hypothesis (Ha or H1): This is the statement that contradicts the null hypothesis and
suggests that there is a significant difference or effect. It is what you are trying to find evidence for.

2. Collecting Data:
- A sample of data is collected from a population.

3. Choosing a Significance Level (α):


- The significance level, often denoted by α (alpha), is the probability of rejecting the null hypothesis
when it is actually true. Common values for α are 0.05 (5%) or 0.01 (1%).

4. Performing Statistical Test:


- A statistical test is chosen based on the type of data and the research question. Common tests include t-
tests, ANOVA, chi-squared tests, and more.
- The test produces a test statistic and a p-value.

5. Making a Decision:
- Compare the p-value to the significance level (α).
- If p-value ≤ α, you reject the null hypothesis and conclude that there is enough evidence to support the
alternative hypothesis.
- If p-value > α, you fail to reject the null hypothesis and do not have enough evidence to support the
alternative hypothesis.

6. Drawing Conclusions:
- If the null hypothesis is rejected, you may make conclusions about the population based on the sample
data.
- If the null hypothesis is not rejected, you typically cannot make definitive conclusions about the
population based on the sample data.

It's important to note that failing to reject the null hypothesis does not necessarily mean that the null
hypothesis is true; it simply means that there is not enough evidence to support the alternative hypothesis
based on the current sample.

Hypothesis testing helps researchers make informed decisions and draw reliable conclusions from data
while considering the inherent uncertainty and variability in real-world observations.
Types of Hypothesis testing
There are several types of hypothesis testing, each suited to different research scenarios and questions.
Here are some of the most common types:

1. One-Sample Z-Test/T-Test: Used to test whether the mean of a single sample is significantly different
from a known or hypothesized population mean. The Z-test is used when the population standard
deviation is known, while the t-test is used when it is unknown and must be estimated from the sample.

2. Two-Sample Independent T-Test: Compares the means of two independent samples to determine if
they come from populations with different means.

3. Paired (Dependent) T-Test: Compares means of two related samples (e.g., before and after
measurements) to assess whether there is a significant difference in the pairs.

4. Analysis of Variance (ANOVA): Used to compare means of three or more groups to determine if there
are statistically significant differences among them. One-way ANOVA compares means from one factor,
while two-way ANOVA considers interactions between two factors.

5. Chi-Square Test: Used to test the independence of categorical variables in a contingency table. It
assesses whether there is a significant association between the variables.

6. Goodness-of-Fit Test: Determines whether observed frequencies in a categorical dataset match the
expected frequencies based on a theoretical distribution.

7. F-Test: Used in analysis of variance to compare variances of two or more groups, assessing whether
they are significantly different.

8. Z-Test for Proportions: Tests whether the proportion of successes in a sample is significantly different
from a hypothesized population proportion.

9. Wilcoxon Rank-Sum Test (Mann-Whitney U Test): Non-parametric test for comparing medians of
two independent samples when assumptions for the t-test are not met.

10. Kolmogorov-Smirnov Test: Used to assess if a sample comes from a specific distribution by
comparing its cumulative distribution function to the expected distribution.

11. Wilcoxon Signed-Rank Test: Non-parametric test for comparing medians of two related samples
(e.g., before and after measurements).

12. Kruskal-Wallis Test: Non-parametric alternative to ANOVA, used to compare three or more
independent groups.

13. Mood's Median Test: Non-parametric test to determine if there is a significant difference between
medians of two independent samples.

These are just a few examples of the many types of hypothesis tests available in statistics. The choice of
test depends on the nature of the data, the research question, and the assumptions being made. It's
important to select the appropriate test based on the specific context of your analysis and the
characteristics of your data.
One-Sample Z-Test/T-Test:

• One-Sample Z-Test Example:

Suppose a fast-food chain claims that the average weight of their hamburger is 150 grams. You want to
test whether this claim is accurate.

Null Hypothesis (H0): The average weight of the hamburgers is 150 grams.
Alternative Hypothesis (H1): The average weight of the hamburgers is not 150 grams.

You collect a random sample of 25 hamburgers and measure their weights. The sample mean weight is
148 grams, and the population standard deviation is known to be 5 grams.

You can perform a one-sample z-test to test the claim:

1. Calculate the test statistic:

2. Determine the critical value for a chosen significance level (α) or calculate the p-value.

3. If the critical value falls within the rejection region or the p-value is less than α, you can reject the null
hypothesis.

• One-Sample T-Test Example:

Consider a scenario where a company claims that the average call duration of their customer service calls
is 8 minutes. You want to determine whether the average call duration is different from this claim.

Null Hypothesis (H0): The average call duration is 8 minutes.


Alternative Hypothesis (H1): The average call duration is not 8 minutes.

You collect a random sample of 30 customer service call durations and find that the sample mean is 7.5
minutes, and the sample standard deviation is 1.2 minutes.

Since the population standard deviation is not known, you'll use a one-sample t-test:

1. Calculate the test statistic:

2. Determine the degrees of freedom and look up the critical t-value for a chosen significance level (α) or
calculate the p-value.

3. If the critical t-value falls within the rejection region or the p-value is less than α, you can reject the null
hypothesis.

In both examples, if you reject the null hypothesis, you would conclude that there is evidence to suggest
that the average weight of the hamburgers or the average call duration is different from the claimed value.
If you fail to reject the null hypothesis, you wouldn't have sufficient evidence to dispute the claims. The
choice between the z-test and t-test depends on whether the population standard deviation is known or
unknown.
Two-Sample Independent T-Test:
The two-sample independent t-test involves formulating null and alternative hypotheses to test whether
there is a significant difference between the means of two independent groups or samples. Let's use the
scenario of comparing exam scores from Class A and Class B as an example.

Null Hypothesis (H0): The mean exam scores of Class A and Class B are equal.
Alternative Hypothesis (H1): The mean exam scores of Class A and Class B are not equal.

Mathematically, the hypotheses can be expressed as:

H0: μA = μB
H1: μA ≠ μB

Where:
- H0 represents the null hypothesis.
- H1 represents the alternative hypothesis.
- μA is the population mean exam score for Class A.
- μB is the population mean exam score for Class B.

The two-sample independent t-test is used to compare the means of two independent groups or samples to
determine if there is a statistically significant difference between them. This test is appropriate when you
want to assess whether the means of two populations are truly different based on data collected from
separate and unrelated samples.

Example:
Suppose you want to compare the exam scores of two different classes (Class A and Class B) to determine
if there is a significant difference in their average scores. Class A consists of 30 students, and Class B
consists of 35 students. You have the following data:
Class A Scores: [78, 85, 92, 68, 75, 80, 88, 81, 72, 90, 95, 83, 87, 79, 70, 91, 84, 89, 76, 82, 93, 77, 86, 73,
74, 97, 67, 94, 69, 71]
Class B Scores: [72, 77, 81, 65, 70, 75, 85, 80, 68, 82, 88, 78, 76, 73, 67, 79, 83, 84, 71, 74, 90, 69, 86, 89,
87, 63, 81, 72, 77, 80, 85, 78, 84]
Null Hypothesis (H0): The mean exam scores of Class A and Class B are equal (μA = μB).
Alternative Hypothesis (H1): The mean exam scores of Class A and Class B are not equal (μA ≠ μB).

Steps to Conduct the Two-Sample Independent T-Test:

1. Calculate the sample means and sample standard deviations for each group (Class A and Class B).

2. Calculate the pooled standard error:

3. Calculate the t-statistic:


4. Determine the degrees of freedom (df) using the formula:
5. Find the critical t-value based on the chosen significance level (α) and degrees of freedom, or
calculate the p-value.
6. Compare the calculated t-statistic to the critical t-value or compare the p-value to α.
7. If the calculated t-statistic is greater than the critical t-value (or if the p-value is less than α), you
can reject the null hypothesis and conclude that there is a significant difference in the means of the
two groups.

In your analysis, if you find that the t-test results indicate a significant difference between the two classes'
exam scores, you can conclude that there is evidence to support the claim that the average exam scores of
Class A and Class B are different. If the results do not show a significant difference, you wouldn't have
sufficient evidence to reject the null hypothesis and would not conclude a significant difference between
the two classes.
Paired (Dependent) T-Test
The paired (dependent) t-test is used to compare the means of two related groups or samples, where each
data point in one group is matched or paired with a corresponding data point in the other group. This test
is appropriate when you want to assess whether there is a significant difference in the means of the paired
observations.
Let's use an example of a before-and-after scenario to illustrate the hypotheses for a paired t-test:

Null Hypothesis (H0): The mean difference in test scores before and after the training program is zero.
Alternative Hypothesis (H1): The mean difference in test scores before and after the training program is
not zero.

Mathematically, the hypotheses can be expressed as:

H0: μd = 0
H1: μd ≠ 0

Where:
- H0 represents the null hypothesis.
- H1 represents the alternative hypothesis.
- μd is the population mean difference in test scores before and after the training program.

In summary, the paired (dependent) t-test hypothesis testing process involves comparing the mean
difference between paired observations to determine if there is a statistically significant effect or change,
based on the calculated t-statistic and p-value.

Example:
Suppose you want to assess whether a new teaching method improves students' test scores. You select a
random sample of 15 students and have them take a math test before and after implementing the new
teaching method. You want to determine if there is a significant improvement in the students' scores after
the teaching method.
Data:
Before Teaching Method: [85, 78, 92, 76, 88, 90, 82, 79, 70, 95, 81, 73, 87, 89, 77]
After Teaching Method: [90, 82, 95, 79, 92, 94, 86, 84, 78, 98, 88, 80, 93, 91, 81]

Null Hypothesis (H0): The mean difference in test scores before and after the teaching method is zero.
Alternative Hypothesis (H1): The mean difference in test scores before and after the teaching method is
not zero.

Mathematically, the hypotheses can be expressed as:

H0: μd = 0
H1: μd ≠ 0

Where:
- H0 represents the null hypothesis.
- H1 represents the alternative hypothesis.
- μd is the population mean difference in test scores before and after the teaching method.

Steps to Conduct the Paired (Dependent) T-Test:

1. Calculate the differences between the pairs of scores:

2. Calculate the sample mean and sample standard deviation of the differences.

3. Calculate the standard error of the mean difference:


4. Calculate the t-statistic:
5. Determine the degrees of freedom , where is the number of pairs.
6. Find the critical t-value based on the chosen significance level (α) and degrees of freedom, or
calculate the p-value.
7. Compare the calculated t-statistic to the critical t-value or compare the p-value to α.
8. If the calculated t-statistic is greater than the critical t-value (or if the p-value is less than α), you
can reject the null hypothesis and conclude that there is a significant improvement in test scores
after the teaching method.

In this example, if the t-test results indicate a significant improvement in test scores after implementing
the teaching method, you can conclude that there is evidence to support the claim that the new teaching
method leads to improved student performance. If the results do not show a significant improvement, you
wouldn't have sufficient evidence to reject the null hypothesis and would not conclude a significant effect
of the teaching method.

Analysis of Variance (ANOVA):


Analysis of Variance (ANOVA) is a statistical method used to compare means of three or more groups to
determine if there are statistically significant differences among them. ANOVA assesses whether the
variation between group means is greater than the variation within the groups. The hypotheses for
ANOVA depend on the number of groups being compared.
Here's how the hypotheses are formulated for a one-way ANOVA, which compares means across one
factor:

Example:
Suppose you are investigating the effect of different fertilizer treatments on the growth of plants. You
have three groups, each treated with a different fertilizer (A, B, and C), and you want to determine if there
are significant differences in plant heights among the groups.

Null Hypothesis (H0): The mean plant heights of all fertilizer groups are equal.
Alternative Hypothesis (H1): At least one group mean is different from the others.

Mathematically, the hypotheses can be expressed as:


H0: μ1 = μ2 = μ3 (where μ1, μ2, and μ3 are the population mean plant heights for fertilizers A, B, and C,
respectively)
H1: At least one μi is different from the others (for some i).

Steps to Conduct One-Way ANOVA:


1. Calculate the sample means and sample variances for each group.

2. Calculate the grand mean of all observations.


3. Calculate the sum of squares between groups (SSB), which quantifies the variation between group

means , where k is the number of groups.


4. Calculate the sum of squares within groups (SSW), which quantifies the variation within each

group: , where is the number of observations in


group i.

5. Calculate the F-statistic: , where N is the total number of observations.


6. Determine the critical F-value based on the chosen significance level (α) and degrees of freedom.
7. Compare the calculated F-statistic to the critical F-value.
8. If the calculated F-statistic is greater than the critical F-value, you can reject the null hypothesis
and conclude that there are significant differences among the group means.
Example:
Suppose you are a researcher studying the effect of different teaching methods on student performance.
You have three teaching methods: Traditional Lecture (Method A), Interactive Discussion (Method B),
and Hands-On Activities (Method C). You want to determine if there are significant differences in test
scores among the three teaching methods.
Data:
Method A Scores: [75, 82, 88, 71, 90, 79, 84, 77, 83, 81]
Method B Scores: [88, 92, 95, 81, 87, 93, 89, 86, 90, 84]
Method C Scores: [92, 85, 79, 96, 88, 80, 91, 83, 87, 82]

Null Hypothesis (H0): The mean test scores of all teaching methods are equal.
Alternative Hypothesis (H1): At least one teaching method mean is different from the others.

Mathematically, the hypotheses can be expressed as:


H0: μA = μB = μC (where μA, μB, and μC are the population mean test scores for Methods A, B, and C,
respectively)
H1: At least one μi is different from the others (for some i).

Steps to Conduct One-Way ANOVA:


1. Calculate the sample means and sample variances for each teaching method.

2. Calculate the grand mean


3. Calculate the sum of squares between groups (SSB):

.
4. Calculate the sum of squares within groups (SSW):

5. Calculate the mean square between groups (MSB):

6. Calculate the mean square within groups (MSW):

7. Calculate the F-statistic:


8. Determine the critical F-value based on the chosen significance level (α) and degrees of freedom.
9. Compare the calculated F-statistic to the critical F-value.
10. If the calculated F-statistic is greater than the critical F-value, you can reject the null hypothesis
and conclude that there are significant differences among the teaching methods' mean test scores.

In this example, if the ANOVA results indicate significant differences in test scores among the different
teaching methods, you can conclude that the teaching methods have a significant effect on student
performance. If the results do not show significant differences, you wouldn't have sufficient evidence to
reject the null hypothesis and would not conclude significant effects of the teaching methods.
Chi-square test:
Example:
Suppose you are conducting a survey to investigate whether there is a relationship between gender and
preference for different modes of transportation to work. You survey a random sample of 200 individuals
and ask them to choose their preferred mode of transportation: Car, Public Transit, Bicycle, or Walking.
You also record their gender: Male or Female. You want to determine if there is a significant association
between gender and transportation preference.
Data:

Null Hypothesis (H0): Gender and transportation preference are independent (no association).
Alternative Hypothesis (H1): Gender and transportation preference are not independent (there is an
association).

Mathematically, the hypotheses can be expressed as:

H0: Gender and transportation preference are independent.


H1: Gender and transportation preference are not independent.

Steps to Conduct the Chi-Square Test:


1. Create an observed frequency table based on the data.
2. Calculate the expected frequencies for each cell under the assumption of independence. To
calculate expected frequencies, use the formula:

3. Calculate the chi-square test statistic: , where O is the observed frequency


and E is the expected frequency for each cell.
4. Determine the degrees of freedom (df):
5. .
6. Find the critical chi-square value based on the chosen significance level (α) and degrees of
freedom, or calculate the p-value.
7. Compare the calculated chi-square statistic to the critical chi-square value.
8. If the calculated chi-square statistic is greater than the critical chi-square value, you can reject the
null hypothesis and conclude that there is a significant association between gender and
transportation preference.

In this example, if the chi-square test results indicate a significant association between gender and
transportation preference, you can conclude that gender and transportation preference are not independent,
and there is evidence of a relationship between the two variables. If the results do not show a significant
association, you wouldn't have sufficient evidence to reject the null hypothesis and would not conclude an
association between gender and transportation preference.
Goodness-of-fit test:
Example:
Suppose you are investigating whether the distribution of eye colors in a population follows the expected
proportions based on a theoretical model. The theoretical model predicts the following distribution of eye
colors: Brown (40%), Blue (30%), Green (20%), and Other (10%). You collect data from a random
sample of 200 individuals and record their eye colors. You want to determine if the observed distribution
matches the expected distribution.
Data:

Null Hypothesis (H0): The observed distribution of eye colors matches the expected distribution.
Alternative Hypothesis (H1): The observed distribution of eye colors does not match the expected
distribution.

Mathematically, the hypotheses can be expressed as:

H0: The observed frequencies match the expected frequencies.


H1: The observed frequencies do not match the expected frequencies.

Steps to Conduct the Goodness-of-Fit Test:

1. Set up a null and alternative hypothesis as described above.


2. Create an observed frequency table based on the data.
3. Calculate the expected frequencies based on the theoretical model.

4. Calculate the chi-square test statistic: , where O is the observed frequency


and E is the expected frequency for each category.
5. Determine the degrees of freedom (df): df= Number of Categories- 1.
6. Find the critical chi-square value based on the chosen significance level (α) and degrees of
freedom, or calculate the p-value.
7. Compare the calculated chi-square statistic to the critical chi-square value.
8. If the calculated chi-square statistic is greater than the critical chi-square value, you can reject the
null hypothesis and conclude that the observed distribution does not match the expected
distribution.

In this example, if the goodness-of-fit test results indicate a significant difference between the observed
and expected distributions of eye colors, you can conclude that there is evidence that the distribution in the
population does not match the theoretical model. If the results do not show a significant difference, you
wouldn't have sufficient evidence to reject the null hypothesis and would not conclude a mismatch
between the observed and expected distributions.
F-test:

Example:
Suppose you are comparing the variances of three different machines used for manufacturing a specific
component. You want to determine if there is a significant difference in the variability of the
measurements taken by these machines.

Data:
Machine 1: [8.5, 8.2, 9.0, 7.8, 8.4, 8.7, 9.1, 8.3, 7.6, 8.9]
Machine 2: [7.9, 8.1, 7.5, 8.3, 7.7, 8.0, 7.8, 8.2, 7.6, 8.4]
Machine 3: [9.3, 9.1, 9.5, 9.2, 9.4, 9.0, 9.6, 9.3, 9.2, 9.7]

Null Hypothesis (H0): The variances of the measurements from the three machines are equal.
Alternative Hypothesis (H1): At least one variance is different from the others.

Mathematically, the hypotheses can be expressed as:

H0: σ1^2 = σ2^2 = σ3^2 (where σ1^2, σ2^2, and σ3^2 are the population variances for Machines 1, 2, and
3, respectively)
H1: At least one σi^2 is different from the others (for some i).

Steps to Conduct an F-Test for Comparing Variances:

1. Set up a null and alternative hypothesis as described above.

2. Calculate the sample variances for each machine.

a.

3. Calculate the F-statistic: .

4. Determine the degrees of freedom for the numerator and denominator: df1 = (Number of Samples)
- 1 and df2 = (Total Number of Observations) - (Number of Samples).

5. Find the critical F-value based on the chosen significance level (α) and degrees of freedom.

6. Compare the calculated F-statistic to the critical F-value.

7. If the calculated F-statistic is greater than the critical F-value, you can reject the null hypothesis
and conclude that there is a significant difference in the variability of the measurements taken by
the machines.

In this example, if the F-test results indicate a significant difference in the variances of the measurements
from the three machines, you can conclude that the variability among the machines is not equal. If the
results do not show a significant difference, you wouldn't have sufficient evidence to reject the null
hypothesis and would not conclude a difference in variability.
Z-test for proportions:
Example:
Suppose you are working for a marketing research company and you want to determine whether the
proportion of customers who purchased a product has changed after a recent marketing campaign. You
collected data before and after the campaign and want to test if there is a significant difference in the
proportions of customers who made a purchase.

Data:
Before Campaign: Out of a random sample of 500 customers, 80 purchased the product.
After Campaign: Out of a random sample of 600 customers, 140 purchased the product.

Null Hypothesis (H0): The proportions of customers who purchased the product before and after the
campaign are equal.
Alternative Hypothesis (H1): The proportions of customers who purchased the product before and after
the campaign are not equal.

Mathematically, the hypotheses can be expressed as:

H0: p1 = p2 (where p1 is the proportion of customers who purchased before the campaign, and p2 is the
proportion of customers who purchased after the campaign)
H1: p1 ≠ p2

Steps to Conduct a Z-Test for Proportions:

1. Set up a null and alternative hypothesis as described above.


2. Calculate the sample proportions for before and after the campaign:

a) Sample Proportion (Before Campaign):

b) Sample Proportion (After Campaign):

c) Calculate the pooled proportion , where the total number


of purchases is the sum of purchases before and after the campaign, and the total sample size is the
sum of the sample sizes before and after.

3. Calculate the standard error (\(SE\)) of the difference in proportions: SE =

, where is the sample size before the campaign and


is the sample size after the campaign.

4. Calculate the z-score: .


5. Determine the critical z-value based on the chosen significance level (α) for a two-tailed test.
6. Compare the calculated z-score to the critical z-value.
7. If the calculated z-score is greater than the positive critical z-value or less than the negative
critical z-value, you can reject the null hypothesis and conclude that there is a significant
difference in the proportions of customers who purchased before and after the campaign.

In this example, if the z-test results indicate a significant difference in the proportions of customers who
purchased the product before and after the campaign, you can conclude that the marketing campaign had a
significant impact on customer purchasing behavior. If the results do not show a significant difference,
you wouldn't have sufficient evidence to reject the null hypothesis and would not conclude a difference in
proportions.
Wilcoxon Rank-Sum Test (Mann-Whitney U Test):
The Mann-Whitney U test, also known as the Wilcoxon rank-sum test, is a non-parametric test used to
compare two independent samples and determine if there is a significant difference between their
distributions. It is often used when the assumptions for a parametric test like the independent t-test are not
met.

Example:
Suppose you want to compare the exam scores of two groups of students, Group A and Group B, to
determine if there is a significant difference in their performance. You collected data from both groups and
want to test if there is a significant difference between the distributions of the two groups.

Data:
Group A Scores: [82, 88, 75, 95, 68, 72, 87, 91, 80, 78]
Group B Scores: [76, 84, 70, 92, 65, 70, 85, 89, 82, 77]

Null Hypothesis (H0): There is no difference in the distributions of the two groups.
Alternative Hypothesis (H1): There is a difference in the distributions of the two groups.

Steps to Conduct a Mann-Whitney U Test:

1. Set up a null and alternative hypothesis as described above.

2. Combine the data from both groups and rank the observations from smallest to largest,
assigning ranks based on their order. Tied observations receive the average rank.

3. Calculate the sum of ranks for each group: for Group A and for Group B. is
the sum of ranks for Group A, and is the sum of ranks for Group B.

4. Calculate the smaller of and as , the Mann-Whitney U statistic.

5. Calculate the expected value of under the null hypothesis:

, where is the sample size of Group A and is the sample size


of Group B.

6. Calculate the variance of under the null hypothesis:

7. Calculate the z-score:


8. Determine the critical value of the z-score based on the chosen significance level (α).

9. Compare the calculated z-score to the critical value of the z-score.

10. If the calculated z-score is greater than the positive critical value or less than the negative
critical value, you can reject the null hypothesis and conclude that there is a significant
difference between the distributions of the two groups.

In this example, if the Mann-Whitney U test results indicate a significant difference between the
distributions of the exam scores of Group A and Group B, you can conclude that there is evidence of a
difference in performance between the two groups. If the results do not show a significant difference, you
wouldn't have sufficient evidence to reject the null hypothesis and would not conclude a difference in
distributions.
The Kolmogorov-Smirnov test:
The Kolmogorov-Smirnov test is a non-parametric test used to assess whether a sample comes from a
specific distribution or if two samples come from the same distribution. It is used to compare the empirical
distribution of the data to a specified theoretical distribution or to compare two independent samples.
Here's an example of how the Kolmogorov-Smirnov test can be applied to a single sample:

Example:
Suppose you have a dataset of 50 exam scores and you want to test if the distribution of the scores follows
a normal distribution. You are interested in determining whether the data is consistent with a normal
distribution.

Data:
Exam Scores: [72, 85, 78, 92, 68, 88, 77, 81, 90, 85, 78, 84, 79, 87, 91, 82, 75, 86, 89, 80, 72, 83, 87, 95,
76, 70, 93, 88, 74, 81, 84, 78, 89, 82, 90, 79, 88, 84, 81, 86, 83, 92, 87, 85, 80, 76, 83, 88, 81]

Null Hypothesis (H0): The exam scores follow a normal distribution.


Alternative Hypothesis (H1): The exam scores do not follow a normal distribution.

Steps to Conduct a Kolmogorov-Smirnov Test:

1. Set up a null and alternative hypothesis as described above.

2. Sort the data in ascending order.

3. Calculate the cumulative distribution function (CDF) of the data:

4. Calculate the expected cumulative distribution function for a normal distribution with the same
mean and standard deviation as the data.

5. Calculate the maximum absolute difference D between the observed CDF and the expected CDF.

6. Calculate the critical value of D based on the chosen significance level (α) and the sample size.

7. Compare the calculated D value to the critical value of D.

8. If the calculated D value is greater than the critical value of D, you can reject the null hypothesis
and conclude that the data does not follow a normal distribution.

In this example, if the Kolmogorov-Smirnov test results indicate that the calculated D value is greater than
the critical value, you can conclude that the exam scores do not follow a normal distribution. If the results
do not show a significant difference, you wouldn't have sufficient evidence to reject the null hypothesis
and would not conclude a departure from a normal distribution.
Wilcoxon signed-rank test:

Example:
Suppose you are investigating whether a new study technique improves students' test scores. You have
data from a group of 12 students who took a test before and after using the new study technique. You want
to determine if there is a significant difference in test scores before and after using the technique.

Data:
Before Study Technique: [75, 82, 68, 70, 88, 65, 79, 72, 84, 77, 90, 73]
After Study Technique: [85, 88, 72, 74, 90, 68, 82, 75, 92, 80, 96, 78]

Null Hypothesis (H0): There is no significant difference in test scores before and after using the study
technique.
Alternative Hypothesis (H1): There is a significant difference in test scores before and after using the
study technique.

Mathematically, the hypotheses can be expressed as:

H0: The median of the differences is zero.


H1: The median of the differences is not zero.

Steps to Conduct a Wilcoxon Signed-Rank Test:

1. Set up a null and alternative hypothesis as described above.

2. Calculate the differences between the paired measurements (after - before).

3. Calculate the absolute values of the differences and rank them from smallest to largest, assigning
the smallest rank to the smallest absolute difference.

4. For tied absolute differences, assign the average of the ranks that would have been assigned to
those values.

5. Identify the positive and negative ranks and calculate the sum of the ranks for positive
differences and the sum of the ranks for negative differences.

6. Calculate the test statistic , which is the smaller of and .

7. Determine the critical value of the test statistic for the chosen significance level (α) and sample
size. Alternatively, calculate the p-value associated with the test statistic.

8. Compare the calculated test statistic to the critical value or compare the p-value to α.

9. If the calculated test statistic is greater than the critical value (or if the p-value is less than α), you
can reject the null hypothesis and conclude that there is a significant difference in test scores
before and after using the study technique.

In this example, if the Wilcoxon signed-rank test results indicate a significant difference in test scores
before and after using the study technique, you can conclude that the study technique has a significant
effect on improving test scores. If the results do not show a significant difference, you wouldn't have
sufficient evidence to reject the null hypothesis and would not conclude a significant effect of the study
technique.
Kruskal-Wallis test:
Example:
Suppose you are conducting a study to compare the average scores of three different groups of students on
a standardized math test. The three groups are taught using different teaching methods: Group A receives
traditional lecture-based instruction, Group B receives interactive group discussions, and Group C receives
hands-on activities. You want to determine if there is a significant difference in the average test scores
among the three groups.

Data:
Group A Scores: [85, 78, 92, 76, 88, 90, 82]
Group B Scores: [90, 82, 95, 79, 92, 94, 86, 84]
Group C Scores: [92, 85, 79, 96, 88, 80, 91, 83, 87]

Null Hypothesis (H0): There is no significant difference in the average test scores among the three
groups.
Alternative Hypothesis (H1): There is a significant difference in the average test scores among the three
groups.

Mathematically, the hypotheses can be expressed as:

H0: The population median test scores are the same for all three groups.
H1: At least one population median test score is different.

Steps to Conduct a Kruskal-Wallis Test:

1. Set up a null and alternative hypothesis as described above.

2. Combine the scores from all groups and rank them in ascending order, assigning ranks to ties by
averaging the ranks.

3. Calculate the sum of the ranks T for each group.

4. Calculate the Kruskal-Wallis test statistic: , where N is


the total number of observations, is the sum of ranks for group i, and is the number of
observations in group i.

5. Determine the degrees of freedom , where k is the number of groups.

6. Find the critical value of the test statistic for the chosen significance level (α) and degrees of
freedom, or calculate the p-value associated with the test statistic.

7. Compare the calculated test statistic to the critical value or compare the p-value to (α).

8. If the calculated test statistic is greater than the critical value (or if the p-value is less than (α), you
can reject the null hypothesis and conclude that there is a significant difference in the average test
scores among the three groups.

In this example, if the Kruskal-Wallis test results indicate a significant difference in the average test scores
among the three teaching methods, you can conclude that the teaching methods have a significant effect on
students' test scores. If the results do not show a significant difference, you wouldn't have sufficient
evidence to reject the null hypothesis and would not conclude significant effects of the teaching methods.
Mood's median test:
Example:
Suppose you are studying the effect of three different diets (A, B, and C) on weight loss. You have
collected data on weight loss for a group of individuals who followed each diet for a specific period. You
want to determine if there is a significant difference in the median weight loss among the three diets.

Data:
Diet A Weight Loss: [2.5, 1.8, 2.2, 2.0, 1.7, 2.4, 1.9, 1.5]
Diet B Weight Loss: [1.6, 1.4, 1.8, 1.9, 2.0, 1.5, 1.3, 1.7, 1.6]
Diet C Weight Loss: [2.1, 1.9, 2.5, 2.2, 1.7, 2.3, 2.0]

Null Hypothesis (H0): There is no significant difference in the median weight loss among the three diets.
Alternative Hypothesis (H1): There is a significant difference in the median weight loss among the three
diets.

Steps to Conduct Mood's Median Test:

1. Set up a null and alternative hypothesis as described above.

2. Combine all the weight loss data and rank them in ascending order, assigning ranks to ties by
averaging the ranks.

3. Calculate the sum of ranks for each diet.

4. Calculate the grand median M of all the data.

5. Calculate the test statistic: , where N is the total


number of observations and is the number of observations in diet i.

6. Determine the degrees of freedom , where k is the number of diets.

7. Find the critical value of the test statistic for the chosen significance level (α) and degrees of
freedom, or calculate the p-value associated with the test statistic.

8. Compare the calculated test statistic to the critical value or compare the p-value to (α)

9. If the calculated test statistic is greater than the critical value (or if the p-value is less than (α),you
can reject the null hypothesis and conclude that there is a significant difference in the median
weight loss among the three diets.

In this example, if Mood's median test results indicate a significant difference in the median weight loss
among the three diets, you can conclude that the diets have a significant effect on weight loss. If the
results do not show a significant difference, you wouldn't have sufficient evidence to reject the null
hypothesis and would not conclude significant effects of the diets.
Conclusion
Hypothesis testing is a powerful statistical method used to make informed decisions and draw conclusions
based on data. It allows researchers and analysts to objectively assess whether there is enough evidence to
support a particular claim or hypothesis about a population.
In hypothesis testing, after performing the appropriate test and obtaining the results, you draw a
conclusion based on the comparison of the test statistic to critical values or the p-value to the significance
level. The conclusion can be summarized as follows:
- If the p-value is less than the significance level (α), you reject the null hypothesis. This suggests there
is enough evidence to support the alternative hypothesis.
- If the p-value is greater than or equal to α, you fail to reject the null hypothesis. This indicates that
there is insufficient evidence to support the alternative hypothesis.
Hypothesis testing is a fundamental tool in scientific research, allowing us to make informed decisions
based on data and to draw conclusions that help advance our understanding of the world. It provides a
structured and rigorous approach to testing hypotheses and making objective decisions, helping to reduce
bias and uncertainty in the decision-making process.

References
1. Ott, R. L., & Longnecker, M. (2015). "An Introduction to Statistical Methods and Data Analysis."
Cengage Learning. This book provides a comprehensive introduction to various statistical methods,
including hypothesis testing.

2. Triola, M. F., & Triola, M. M. (2006). "Biostatistics for the Biological and Health Sciences." Pearson.
This book focuses on biostatistics and includes examples of hypothesis testing in the context of health and
biological sciences.

3. Agresti, A., & Finlay, B. (2009). "Statistical Methods for the Social Sciences." Pearson. This book
covers statistical methods commonly used in social sciences and provides explanations and examples of
hypothesis testing.

4. Montgomery, D. C., Peck, E. A., & Vining, G. G. (2012). "Introduction to Linear Regression Analysis."
Wiley. While focusing on regression analysis, this book also covers hypothesis testing and provides a
solid foundation in statistical concepts.

5. Rice, J. A. (2006). "Mathematical Statistics and Data Analysis." Cengage Learning. This book offers a
mathematical approach to statistics, covering various topics including hypothesis testing.

6. Freedman, D., Pisani, R., & Purves, R. (2007). "Statistics." WW Norton & Company. This book
provides a non-technical introduction to statistics, including hypothesis testing, with a focus on concepts
and applications.

7. Hogg, R. V., McKean, J., & Craig, A. T. (2018). "Introduction to Mathematical Statistics." Pearson.
This textbook provides a comprehensive introduction to mathematical statistics, including detailed
coverage of hypothesis testing.

8. Wackerly, D. D., Mendenhall, W., & Scheaffer, R. L. (2007). "Mathematical Statistics with
Applications." Cengage Learning. This book covers mathematical statistics and includes chapters on
hypothesis testing and its applications.

9. Lehmann, E. L., & Romano, J. P. (2005). "Testing Statistical Hypotheses." Springer. This advanced
book provides a detailed and theoretical treatment of hypothesis testing, suitable for those seeking a
deeper understanding.

10. Rosner, B. (2010). "Fundamentals of Biostatistics." Cengage Learning. This book is particularly
focused on biostatistics and includes examples of hypothesis testing in the context of biomedical research.

You might also like