Hypothesis Testing
Learn to perform t-tests, chi-square tests, and interpret p-values for data-driven decisions.
Hypothesis Testing is a free R Academy lesson on CoddyKit. This is lesson 3 of 3. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, and your progress syncs across the web and the CoddyKit app. The R Academy course includes 3 lessons in total.
Introduction to Hypothesis Testing
Hypothesis testing is a statistical method to determine whether there is enough evidence to reject a null hypothesis.

Null and Alternative Hypothesis
In hypothesis testing:
- The null hypothesis (H₀) assumes no effect or difference.
- The alternative hypothesis (H₁) suggests an effect or difference.
Performing a t-Test
A t-test checks if two groups have significantly different means.
data1 <- c(5.1, 6.2, 5.8, 6.5, 5.9)
data2 <- c(7.0, 6.8, 7.5, 7.1, 6.9)
t.test(data1, data2)Interpreting p-values
The p-value helps decide whether to reject H₀:
- If p-value < 0.05, reject H₀ (significant result).
- If p-value > 0.05, fail to reject H₀ (not significant).
Chi-Square Test
The chi-square test checks if categorical variables are independent.
observed <- matrix(c(20, 30, 50, 40), nrow=2)
chisq.test(observed)ANOVA Test
ANOVA compares means across multiple groups.
group1 <- c(5.1, 6.2, 5.8)
group2 <- c(7.0, 6.8, 7.5)
group3 <- c(4.9, 5.5, 5.2)
data <- data.frame(value = c(group1, group2, group3),
group = rep(c('A', 'B', 'C'), each=3))
aov_test <- aov(value ~ group, data = data)
summary(aov_test)Effect Size
Effect size measures the strength of a result, helping determine practical significance.
Limitations of Hypothesis Testing
Hypothesis testing relies on assumptions and can be influenced by sample size and data quality.
Summary
In this lesson, you learned:
- How to perform hypothesis testing.
- How to use t-tests, chi-square, and ANOVA.
- The importance of p-values and effect sizes.

Learn R with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 43
- Lessons
- 159
Frequently Asked Questions
Is the “Hypothesis Testing” lesson free?
Yes — any 3 lessons of the R Academy learning path, including “Hypothesis Testing”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The R Academy course includes 3 lessons in total.
What will I learn in “Hypothesis Testing”?
Learn to perform t-tests, chi-square tests, and interpret p-values for data-driven decisions. You practise R Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start R Academy?
No prior experience is required. R Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 3.
How long does the “Hypothesis Testing” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this R Academy lesson?
Yes. Every R Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Descriptive Statistics
- Probability Distributions
- Hypothesis Testing