Hypothesis Testing Explanation Tool
An interactive guide to statistical decision making.
What is Hypothesis Testing?
Hypothesis testing is a formal procedure used by statisticians to test whether a hypothesis can be accepted or not. It's a way of using sample data to make decisions about a whole population.
For example, a company might want to know if a new advertising campaign has led to a significant increase in sales. Hypothesis testing provides a structured framework to answer such questions.
This tool will walk you through the core steps of this process.
The Null Hypothesis ($H_0$)
This is the default assumption, or the status quo. It usually states that there is "no effect" or "no difference." We conduct our test to see if we have enough evidence to challenge this assumption.
The Alternative Hypothesis ($H_1$ or $H_a$)
This is what we are trying to prove. It's the claim or theory that contradicts the null hypothesis. It states that there *is* an effect or a difference.
Significance Level ($\alpha$)
Before we collect data, we must set a "significance level," denoted by the Greek letter alpha ($\alpha$). This is the threshold for how surprised we need to be by our data to reject the null hypothesis.
It represents the probability of rejecting the null hypothesis when it is actually true (a "Type I Error"). A lower alpha means we require stronger evidence.
The p-value
After conducting an experiment and analyzing the data, we calculate a "p-value."
The p-value is the probability of observing our data (or more extreme data) *if the null hypothesis were true*.
- A small p-value suggests that our observed data is very unlikely under the null hypothesis. This is evidence *against* the null hypothesis.
- A large p-value suggests that our data is quite plausible under the null hypothesis. This is *not* strong evidence against the null hypothesis.
Making the Decision
The rule is simple: If the p-value is less than or equal to the significance level ($\alpha$), we reject the null hypothesis.
Hypothesis Test Summary
${conclusion}
`; renderMathInElement(decisionVisual); }; const populateReview = () => { const { nullHypothesis, altHypothesis, alpha, pValue } = getInputs(); const reviewOutput = document.getElementById('review-output'); let decision, resultColor, resultBg, interpretation; if(pValue <= alpha){ decision = "Reject the Null Hypothesis"; resultColor = "text-green-800"; resultBg = "bg-green-100"; interpretation = `The result is statistically significant at the ${alpha*100}% level. There is sufficient evidence to support the claim that "${altHypothesis}".`; } else { decision = "Fail to Reject the Null Hypothesis"; resultColor = "text-red-800"; resultBg = "bg-red-100"; interpretation = `The result is not statistically significant at the ${alpha*100}% level. There is insufficient evidence to support the claim that "${altHypothesis}".`; } reviewOutput.innerHTML = `1. Hypotheses
Null Hypothesis ($H_0$): ${nullHypothesis}
Alternative Hypothesis ($H_1$): ${altHypothesis}
2. Criteria for Decision
Significance Level ($\alpha$): ${alpha}
3. Results from Data
Calculated p-value: ${pValue}
4. Statistical Decision
Rule: If p-value $\le \alpha$, reject $H_0$.
Comparison: ${pValue} is ${pValue <= alpha ? 'less than or equal to' : 'greater than'} ${alpha}.
Decision: ${decision}
5. Conclusion
${interpretation}
`; renderMathInElement(reviewOutput); }; tabs.forEach(tab => { tab.addEventListener('click', () => { currentTabIndex = tabIds.indexOf(tab.dataset.tab); updateTabs(); }); }); prevButton.addEventListener('click', () => { if (currentTabIndex > 0) { currentTabIndex--; updateTabs(); } }); nextButton.addEventListener('click', () => { if (currentTabIndex < tabIds.length - 1) { currentTabIndex++; updateTabs(); } }); downloadPdfButton.addEventListener('click', () => { downloadPdfButton.textContent = 'Generating PDF...'; downloadPdfButton.disabled = true; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const reviewContent = document.getElementById('review-output'); pdf.html(reviewContent, { callback: function (pdf) { pdf.save('Hypothesis-Test-Summary.pdf'); downloadPdfButton.textContent = 'Download Summary as PDF'; downloadPdfButton.disabled = false; }, x: 25, y: 25, width: 545, windowWidth: reviewContent.scrollWidth }); }); // Initial setup renderMathInElement(document.body, { delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true} ] }); updateTabs(); });