Statistics Tutorial
Descriptive statistics, inferential statistics, stat reference, statistics - hypothesis testing.
Hypothesis testing is a formal way of checking if a hypothesis about a population is true or not.
Hypothesis Testing
A hypothesis is a claim about a population parameter .
A hypothesis test is a formal procedure to check if a hypothesis is true or not.
Examples of claims that can be checked:
The average height of people in Denmark is more than 170 cm.
The share of left handed people in Australia is not 10%.
The average income of dentists is less the average income of lawyers.
The Null and Alternative Hypothesis
Hypothesis testing is based on making two different claims about a population parameter.
The null hypothesis (\(H_{0} \)) and the alternative hypothesis (\(H_{1}\)) are the claims.
The two claims needs to be mutually exclusive , meaning only one of them can be true.
The alternative hypothesis is typically what we are trying to prove.
For example, we want to check the following claim:
"The average height of people in Denmark is more than 170 cm."
In this case, the parameter is the average height of people in Denmark (\(\mu\)).
The null and alternative hypothesis would be:
Null hypothesis : The average height of people in Denmark is 170 cm.
Alternative hypothesis : The average height of people in Denmark is more than 170 cm.
The claims are often expressed with symbols like this:
\(H_{0}\): \(\mu = 170 \: cm \)
\(H_{1}\): \(\mu > 170 \: cm \)
If the data supports the alternative hypothesis, we reject the null hypothesis and accept the alternative hypothesis.
If the data does not support the alternative hypothesis, we keep the null hypothesis.
Note: The alternative hypothesis is also referred to as (\(H_{A} \)).
The Significance Level
The significance level (\(\alpha\)) is the uncertainty we accept when rejecting the null hypothesis in the hypothesis test.
The significance level is a percentage probability of accidentally making the wrong conclusion.
Typical significance levels are:
- \(\alpha = 0.1\) (10%)
- \(\alpha = 0.05\) (5%)
- \(\alpha = 0.01\) (1%)
A lower significance level means that the evidence in the data needs to be stronger to reject the null hypothesis.
There is no "correct" significance level - it only states the uncertainty of the conclusion.
Note: A 5% significance level means that when we reject a null hypothesis:
We expect to reject a true null hypothesis 5 out of 100 times.
Advertisement
The Test Statistic
The test statistic is used to decide the outcome of the hypothesis test.
The test statistic is a standardized value calculated from the sample.
Standardization means converting a statistic to a well known probability distribution .
The type of probability distribution depends on the type of test.
Common examples are:
- Standard Normal Distribution (Z): used for Testing Population Proportions
- Student's T-Distribution (T): used for Testing Population Means
Note: You will learn how to calculate the test statistic for each type of test in the following chapters.
The Critical Value and P-Value Approach
There are two main approaches used for hypothesis tests:
- The critical value approach compares the test statistic with the critical value of the significance level.
- The p-value approach compares the p-value of the test statistic and with the significance level.
The Critical Value Approach
The critical value approach checks if the test statistic is in the rejection region .
The rejection region is an area of probability in the tails of the distribution.
The size of the rejection region is decided by the significance level (\(\alpha\)).
The value that separates the rejection region from the rest is called the critical value .
Here is a graphical illustration:
If the test statistic is inside this rejection region, the null hypothesis is rejected .
For example, if the test statistic is 2.3 and the critical value is 2 for a significance level (\(\alpha = 0.05\)):
We reject the null hypothesis (\(H_{0} \)) at 0.05 significance level (\(\alpha\))
The P-Value Approach
The p-value approach checks if the p-value of the test statistic is smaller than the significance level (\(\alpha\)).
The p-value of the test statistic is the area of probability in the tails of the distribution from the value of the test statistic.
If the p-value is smaller than the significance level, the null hypothesis is rejected .
The p-value directly tells us the lowest significance level where we can reject the null hypothesis.
For example, if the p-value is 0.03:
We reject the null hypothesis (\(H_{0} \)) at a 0.05 significance level (\(\alpha\))
We keep the null hypothesis (\(H_{0}\)) at a 0.01 significance level (\(\alpha\))
Note: The two approaches are only different in how they present the conclusion.
Steps for a Hypothesis Test
The following steps are used for a hypothesis test:
- Check the conditions
- Define the claims
- Decide the significance level
- Calculate the test statistic
One condition is that the sample is randomly selected from the population.
The other conditions depends on what type of parameter you are testing the hypothesis for.
Common parameters to test hypotheses are:
- Proportions (for qualitative data)
- Mean values (for numerical data)
You will learn the steps for both types in the following pages.
COLOR PICKER
Contact Sales
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]
Report Error
If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]
Top Tutorials
Top references, top examples, get certified.
Tutorial Playlist
Statistics tutorial, everything you need to know about the probability density function in statistics, the best guide to understand central limit theorem, measures of central tendency : mean, median and mode, the ultimate guide to understand conditional probability.
Percentile in Statistics
The Best Guide to Understand Bayes Theorem
Everything you need to know about the normal distribution, an in-depth explanation of cumulative distribution function, chi-square test, what is hypothesis testing in statistics types and examples, understanding the fundamentals of arithmetic and geometric progression, the definitive guide to understand spearman’s rank correlation, mean squared error: overview, examples, concepts and more, all you need to know about the empirical rule in statistics, the complete guide to skewness and kurtosis, a holistic look at bernoulli distribution, all you need to know about bias in statistics, a complete guide to get a grasp of time series analysis.
The Key Differences Between Z-Test Vs. T-Test
The Complete Guide to Understand Pearson's Correlation
A complete guide on the types of statistical studies, everything you need to know about poisson distribution, your best guide to understand correlation vs. regression, the most comprehensive guide for beginners on what is correlation, hypothesis testing in statistics - types | examples.
Lesson 10 of 24 By Avijeet Biswal
Table of Contents
In today’s data-driven world, decisions are based on data all the time. Hypothesis plays a crucial role in that process, whether it may be making business decisions, in the health sector, academia, or in quality improvement. Without hypothesis and hypothesis tests, you risk drawing the wrong conclusions and making bad decisions. In this tutorial, you will look at Hypothesis Testing in Statistics.
Become a Certified Power BI Developer
What Is Hypothesis Testing in Statistics?
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.
Hypothesis Testing 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.
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.
Learn All The Tricks Of The BI Trade
Hypothesis Testing Formula
Z = ( x̅ – μ0 ) / (σ /√n)
- Here, x̅ is the sample mean,
- μ0 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.
Your Dream Career is Just Around The Corner!
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 for it.
Let's understand this with an 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.
Take Your Data Scientist Skills to the Next Level
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 the z-score, we would use the following formula:
z = ( x̅ – μ0 ) / (σ /√n)
z = (5'5" - 5'4") / (2" / √100)
z = 0.5 / (0.045)
We will reject the null hypothesis as the z-score 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.
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%).
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.
Collect Data
Gather the data that will be analyzed in the test. To infer conclusions accurately, this data should be representative of the population.
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.
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.
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.
Report the Results
Present the findings from the hypothesis test, including the test statistic, p-value, and the conclusion about the hypotheses.
Perform Post-hoc Analysis (if necessary)
Depending on the results and the study design, further analysis may be needed to explore the data more deeply or to address multiple comparisons if several hypotheses were tested simultaneously.
Types of Hypothesis Testing
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.
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.
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.
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.
Become the Highest Paid Data Science Expert
Hypothesis Testing and Confidence Intervals
Both confidence intervals and hypothesis tests are inferential techniques that depend on approximating the sample distribution. Data from a sample is used to estimate a population parameter using confidence intervals. Data from a sample is used in hypothesis testing to examine a given hypothesis. We must have a postulated parameter to conduct hypothesis testing.
Bootstrap distributions and randomization distributions are created using comparable simulation techniques. The observed sample statistic is the focal point of a bootstrap distribution, whereas the null hypothesis value is the focal point of a randomization distribution.
A variety of feasible population parameter estimates are included in confidence ranges. In this lesson, we created just two-tailed confidence intervals. There is a direct connection between these two-tail confidence intervals and these two-tail hypothesis tests. The results of a two-tailed hypothesis test and two-tailed confidence intervals typically provide the same results. In other words, a hypothesis test at the 0.05 level will virtually always fail to reject the null hypothesis if the 95% confidence interval contains the predicted value. A hypothesis test at the 0.05 level will nearly certainly reject the null hypothesis if the 95% confidence interval does not include the hypothesized parameter.
Become a Data Scientist through hands-on learning with hackathons, masterclasses, webinars, and Ask-Me-Anything sessions! Start learning!
Simple and Composite Hypothesis Testing
Depending on the population distribution, you can classify the statistical hypothesis into two types.
Simple Hypothesis: A simple hypothesis specifies an exact value for the parameter.
Composite Hypothesis: A composite hypothesis specifies a range of values.
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.
Become a Data Scientist With Real-World Experience
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 asterisk "<".
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.
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].
Master Data Science and Unlock Top-Tier Roles
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-world scenarios:
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: Let’s break this down:
- Null Hypothesis (H0): The average amount spent per month is ₹400.
- Alternate Hypothesis (H1): The average amount spent per month is not ₹400.
- Population Standard Deviation (σ): ₹25
- Sample Size (n): 50
- Sample Mean (x̄): ₹250
1. Calculate the z-value:
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.
Did You Know?
Karl Pearson was a British statistician, leading founder of the modern field of statistics , prominent proponent of eugenics , and influential interpreter of the philosophy and social role of science.
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: Here’s how to approach it:
- 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%.
- Sample Size (n): 850
- Significance Level (α): 5%
z=p-PP(1-P)/n
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.
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: Let’s analyze it:
- 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.
- Sample Size for Team A (nA): 1000
- Sample Size for Team B (nB): 800
p=nApA+nBpBnA+nB
p=10000.25+8000.3751000+800 ≈ 0.305
z=pA−pBp(1-p)(1nA+1nB)
z=0.25−0.3750.305(1-0.305) (11000+1800) ≈ −5.72
2. Compare with the critical z-value: For a 5% significance level (one-tailed test), the critical z-value is +1.645. Since -5.72 is far less than +1.645, we reject the null hypothesis. The data indicates that Team B’s performance is significantly worse than Team A’s.
Our Data Scientist Master's Program will help you master core topics such as R, Python, Machine Learning, Tableau, Hadoop, and Spark. Get started on your journey today!
Applications of Hypothesis Testing
Apart from the practical problems, let's look at the real-world applications of hypothesis testing across various fields:
Medicine and Healthcare
In medicine, hypothesis testing plays a pivotal role in assessing the success of new treatments. For example, researchers may want to find out if a new exercise regimen improves heart health. By comparing data from patients who followed the program to those who didn’t, they can determine if the exercise significantly improves health outcomes. Such rigorous testing allows medical professionals to rely on proven methods rather than assumptions.
Quality Control and Manufacturing
In manufacturing, ensuring product quality is vital, and hypothesis testing helps maintain those standards. Suppose a beverage company introduces a new bottling process and wants to verify if it reduces contamination. By analyzing samples from the new and old processes, hypothesis testing can reveal whether the new method reduces the risk of contamination. This allows manufacturers to implement improvements that enhance product safety and quality confidently.
Education and Learning
In education and learning, hypothesis testing is a tool to evaluate the impact of innovative teaching techniques. Imagine a situation where teachers introduce project-based learning to boost critical thinking skills. By comparing the performance of students who engaged in project-based learning with those in traditional settings, educators can test their hypothesis. The results can help educators make informed choices about adopting new teaching strategies.
Environmental Science
Hypothesis testing is essential in environmental science for evaluating the effectiveness of conservation measures. For example, scientists might explore whether a new water management strategy improves river health. By collecting and comparing data on water quality before and after the implementation of the strategy, they can determine whether the intervention leads to positive changes. Such findings are crucial for guiding environmental decisions that have long-term impacts.
Marketing and Advertising
In marketing, businesses use hypothesis testing to refine their approaches. For instance, a clothing brand might test if offering limited-time discounts increases customer loyalty. By running campaigns with and without the discount and analyzing the outcomes, they can assess if the strategy boosts customer retention. Data-driven insights from hypothesis testing enable companies to design marketing strategies that resonate with their audience and drive growth.
Limitations of Hypothesis Testing
Hypothesis testing has some limitations that researchers should be aware of:
- It cannot prove or establish the truth: Hypothesis testing provides evidence to support or reject a hypothesis, but it cannot confirm the absolute truth of the research question.
- Results are sample-specific: Hypothesis testing is based on analyzing a sample from a population, and the conclusions drawn are specific to that particular sample.
- Possible errors: During hypothesis testing, there is a chance of committing type I error (rejecting a true null hypothesis) or type II error (failing to reject a false null hypothesis).
- Assumptions and requirements: Different tests have specific assumptions and requirements that must be met to accurately interpret results.
After reading this tutorial, you would have a much better understanding of hypothesis testing, one of the most important concepts in the field of Data Science . The majority of hypotheses are based on speculation about observed behavior, natural phenomena, or established theories.
If you are interested in statistics of data science and skills needed for such a career, you ought to explore the Post Graduate Program in Data Science.
1. 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 data.
2. What is H0 and H1 in statistics?
In statistics, H0 and H1 represent the null and alternative hypotheses. The null hypothesis, H0, is the default assumption that no effect or difference exists between groups or conditions. The alternative hypothesis, H1, is the competing claim suggesting an effect or a difference. Statistical tests determine whether to reject the null hypothesis in favor of the alternative hypothesis based on the data.
3. What is a simple hypothesis with an example?
A simple hypothesis is a specific statement predicting a single relationship between two variables. It posits a direct and uncomplicated outcome. For example, a simple hypothesis might state, "Increased sunlight exposure increases the growth rate of sunflowers." Here, the hypothesis suggests a direct relationship between the amount of sunlight (independent variable) and the growth rate of sunflowers (dependent variable), with no additional variables considered.
4. What are the 3 major types of hypothesis?
The three major types of hypotheses are:
- Null Hypothesis (H0): Represents the default assumption, stating that there is no significant effect or relationship in the data.
- Alternative Hypothesis (Ha): Contradicts the null hypothesis and proposes a specific effect or relationship that researchers want to investigate.
- Nondirectional Hypothesis: An alternative hypothesis that doesn't specify the direction of the effect, leaving it open for both positive and negative possibilities.
5. What software tools can assist with hypothesis testing?
Several software tools offering distinct features can help with hypothesis testing. R and RStudio are popular for their advanced statistical capabilities. The Python ecosystem, including libraries like SciPy and Statsmodels, also supports hypothesis testing. SAS and SPSS are well-established tools for comprehensive statistical analysis. For basic testing, Excel offers simple built-in functions.
6. 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.
7. 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.
8. Can hypothesis testing be used for non-numerical data?
Yes, 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.
9. 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.
Find our PL-300 Microsoft Power BI Certification Training Online Classroom training classes in top cities:
About the author.
Avijeet is a Senior Research Analyst at Simplilearn. Passionate about Data Analytics, Machine Learning, and Deep Learning, Avijeet is also interested in politics, cricket, and football.
Recommended Resources
Free eBook: Top Programming Languages For A Data Scientist
Normality Test in Minitab: Minitab with Statistics
Secrets to Transition into Data Science from a Non-Tech Background
Machine Learning Career Guide: A Playbook to Becoming a Machine Learning Engineer
- Acknowledgement
- PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, OPM3 and the PMI ATP seal are the registered marks of the Project Management Institute, Inc.
7.4.1 - Hypothesis Testing
Five step hypothesis testing procedure.
In the remaining lessons, we will use the following five step hypothesis testing procedure. This is slightly different from the five step procedure that we used when conducting randomization tests.
- Check assumptions and write hypotheses. The assumptions will vary depending on the test. In this lesson we'll be confirming that the sampling distribution is approximately normal by visually examining the randomization distribution. In later lessons you'll learn more objective assumptions. The null and alternative hypotheses will always be written in terms of population parameters; the null hypothesis will always contain the equality (i.e., \(=\)).
- Calculate the test statistic. Here, we'll be using the formula below for the general form of the test statistic.
- Determine the p-value. The p-value is the area under the standard normal distribution that is more extreme than the test statistic in the direction of the alternative hypothesis.
- Make a decision. If \(p \leq \alpha\) reject the null hypothesis. If \(p>\alpha\) fail to reject the null hypothesis.
- State a "real world" conclusion. Based on your decision in step 4, write a conclusion in terms of the original research question.
General Form of a Test Statistic
When using a standard normal distribution (i.e., z distribution), the test statistic is the standardized value that is the boundary of the p-value. Recall the formula for a z score: \(z=\frac{x-\overline x}{s}\). The formula for a test statistic will be similar. When conducting a hypothesis test the sampling distribution will be centered on the null parameter and the standard deviation is known as the standard error.
This formula puts our observed sample statistic on a standard scale (e.g., z distribution). A z score tells us where a score lies on a normal distribution in standard deviation units. The test statistic tells us where our sample statistic falls on the sampling distribution in standard error units.
7.4.1.1 - Video Example: Mean Body Temperature
Research question: Is the mean body temperature in the population different from 98.6° Fahrenheit?
7.4.1.2 - Video Example: Correlation Between Printer Price and PPM
Research question: Is there a positive correlation in the population between the price of an ink jet printer and how many pages per minute (ppm) it prints?
7.4.1.3 - Example: Proportion NFL Coin Toss Wins
Research question: Is the proportion of NFL overtime coin tosses that are won different from 0.50?
StatKey was used to construct a randomization distribution:
Step 1: Check assumptions and write hypotheses
From the given StatKey output, the randomization distribution is approximately normal.
\(H_0\colon p=0.50\)
\(H_a\colon p \ne 0.50\)
Step 2: Calculate the test statistic
\(test\;statistic=\dfrac{sample\;statistic-null\;parameter}{standard\;error}\)
The sample statistic is the proportion in the original sample, 0.561. The null parameter is 0.50. And, the standard error is 0.024.
\(test\;statistic=\dfrac{0.561-0.50}{0.024}=\dfrac{0.061}{0.024}=2.542\)
Step 3: Determine the p value
The p value will be the area on the z distribution that is more extreme than the test statistic of 2.542, in the direction of the alternative hypothesis. This is a two-tailed test:
The p value is the area in the left and right tails combined: \(p=0.0055110+0.0055110=0.011022\)
Step 4: Make a decision
The p value (0.011022) is less than the standard 0.05 alpha level, therefore we reject the null hypothesis.
Step 5: State a "real world" conclusion
There is evidence that the proportion of all NFL overtime coin tosses that are won is different from 0.50
7.4.1.4 - Example: Proportion of Women Students
Research question : Are more than 50% of all World Campus STAT 200 students women?
Data were collected from a representative sample of 501 World Campus STAT 200 students. In that sample, 284 students were women and 217 were not women.
StatKey was used to construct a sampling distribution using randomization methods:
Because this randomization distribution is approximately normal, we can find the p value by computing a standardized test statistic and using the z distribution.
The assumption here is that the sampling distribution is approximately normal. From the given StatKey output, the randomization distribution is approximately normal.
\(H_0\colon p=0.50\) \(H_a\colon p>0.50\)
2. Calculate the test statistic
\(test\;statistic=\dfrac{sample\;statistic-hypothesized\;parameter}{standard\;error}\)
The sample statistic is \(\widehat p = 284/501 = 0.567\).
The hypothesized parameter is the value from the hypotheses: \(p_0=0.50\).
The standard error on the randomization distribution above is 0.022.
\(test\;statistic=\dfrac{0.567-0.50}{0.022}=3.045\)
3. Determine the p value
We can find the p value by constructing a standard normal distribution and finding the area under the curve that is more extreme than our observed test statistic of 3.045, in the direction of the alternative hypothesis. In other words, \(P(z>3.045)\):
Our p value is 0.0011634
4. Make a decision
Our p value is less than or equal to the standard 0.05 alpha level, therefore we reject the null hypothesis.
5. State a "real world" conclusion
There is evidence that the proportion of all World Campus STAT 200 students who are women is greater than 0.50.
7.4.1.5 - Example: Mean Quiz Score
Research question: Is the mean quiz score different from 14 in the population?
\(H_0\colon \mu = 14\)
\(H_a\colon \mu \ne 14\)
The sample statistic is the mean in the original sample, 13.746 points. The null parameter is 14 points. And, the standard error, 0.142, can be found on the StatKey output.
\(test\;statistic=\dfrac{13.746-14}{0.142}=\dfrac{-0.254}{0.142}=-1.789\)
The p value will be the area on the z distribution that is more extreme than the test statistic of -1.789, in the direction of the alternative hypothesis:
This was a two-tailed test. The p value is the area in the left and right tails combined: \(p=0.0368074+0.0368074=0.0736148\)
The p value (0.0736148) is greater than the standard 0.05 alpha level, therefore we fail to reject the null hypothesis.
There is not enough evidence to state that the mean quiz score in the population is different from 14 points.
7.4.1.6 - Example: Difference in Mean Commute Times
Research question: Do the mean commute times in Atlanta and St. Louis differ in the population?
COMMENTS
Nov 8, 2019 · Step 5: Present your findings. The results of hypothesis testing will be presented in the results and discussion sections of your research paper, dissertation or thesis.. In the results section you should give a brief summary of the data and a summary of the results of your statistical test (for example, the estimated difference between group means and associated p-value).
A statistical hypothesis test is a method of statistical inference used to decide whether the data sufficiently supports a particular hypothesis. A statistical hypothesis test typically involves a calculation of a test statistic .
The Test Statistic. The test statistic is used to decide the outcome of the hypothesis test. The test statistic is a standardized value calculated from the sample. Standardization means converting a statistic to a well known probability distribution. The type of probability distribution depends on the type of test. Common examples are:
Hypothesis testing in statistics is a way for you to test the results of a survey or experiment to see if you have meaningful results. You’re basically testing whether your results are valid by figuring out the odds that your results have happened by chance.
Oct 11, 2018 · A hypothesis test is a formal statistical test we use to reject or fail to reject a statistical hypothesis. The Two Types of Statistical Hypotheses. To test whether a statistical hypothesis about a population parameter is true, we obtain a random sample from the population and perform a hypothesis test on the sample data.
A hypothesis, in statistics, is a statement about a population parameter, where this statement typically is represented by some specific numerical value. In testing a hypothesis, we use a method where we gather data in an effort to gather evidence about the hypothesis. How do we decide whether to reject the null hypothesis?
Nov 26, 2024 · 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.
What is Hypothesis Testing? Hypothesis testing in statistics uses sample data to infer the properties of a whole population. These tests determine whether a random sample provides sufficient evidence to conclude an effect or relationship exists in the population. Researchers use them to help separate genuine population-level effects from false ...
Calculate the test statistic. Here, we'll be using the formula below for the general form of the test statistic. Determine the p-value. The p-value is the area under the standard normal distribution that is more extreme than the test statistic in the direction of the alternative hypothesis. Make a decision.
Oct 3, 2024 · Key Terms in Hypothesis Testing. Before diving into the details, let’s understand some important terms used in hypothesis testing: 1. Test Statistic. The test statistic is a number calculated from your data that is compared against a known distribution (like the normal distribution) to test the null hypothesis.