Challenge - 5 Problems
ANOVA Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of One-Way ANOVA F-statistic Calculation
What is the output of the following Python code that performs a one-way ANOVA test on three groups of data?
Data Analysis Python
import scipy.stats as stats group1 = [23, 21, 19, 24, 30] group2 = [30, 29, 31, 28, 35] group3 = [22, 20, 19, 18, 21] f_stat, p_value = stats.f_oneway(group1, group2, group3) print(round(f_stat, 2))
Attempts:
2 left
💡 Hint
Recall that the F-statistic measures variance between groups relative to variance within groups.
✗ Incorrect
The F-statistic calculated by scipy.stats.f_oneway for these groups is approximately 16.22, indicating significant differences between group means.
❓ data_output
intermediate2:00remaining
Number of Significant Differences in Post-Hoc Test
After performing a one-way ANOVA test that showed significance, a Tukey HSD post-hoc test was run on four groups. How many pairs show a significant difference at alpha=0.05?
Data Analysis Python
import pandas as pd from statsmodels.stats.multicomp import pairwise_tukeyhsd data = pd.DataFrame({ 'value': [5,6,7,8,5,6,7,8,10,11,12,13,10,11,12,13], 'group': ['A','A','A','A','B','B','B','B','C','C','C','C','D','D','D','D'] }) result = pairwise_tukeyhsd(data['value'], data['group'], alpha=0.05) significant_pairs = sum(result.reject) print(significant_pairs)
Attempts:
2 left
💡 Hint
Check how many pairs have reject=True in the Tukey HSD result.
✗ Incorrect
The Tukey HSD test shows significant differences between 4 pairs at alpha=0.05, so the count is 4.
🔧 Debug
advanced2:00remaining
Identify the Error in ANOVA Code
What error will this code raise when trying to perform a one-way ANOVA test?
Data Analysis Python
import scipy.stats as stats # Groups with unequal lengths group1 = [10, 12, 14] group2 = [15, 16] group3 = [20, 22, 23] f_stat, p_value = stats.f_oneway(group1, group2, group3) print(f_stat)
Attempts:
2 left
💡 Hint
Check if scipy.stats.f_oneway requires equal length groups.
✗ Incorrect
scipy.stats.f_oneway can handle groups of unequal length, so no error occurs and the F-statistic is printed.
🧠 Conceptual
advanced2:00remaining
Interpretation of ANOVA p-value
If a one-way ANOVA test returns a p-value of 0.03, what is the correct interpretation at a 0.05 significance level?
Attempts:
2 left
💡 Hint
Recall that p-value less than alpha means rejecting the null hypothesis.
✗ Incorrect
A p-value of 0.03 is less than 0.05, so we reject the null hypothesis that all group means are equal, meaning at least one differs.
🚀 Application
expert3:00remaining
Choosing the Correct ANOVA Type for Data
You have data from three different diets tested on the same group of 10 people measured over three weeks. Which ANOVA test is most appropriate to analyze if diet affects weight loss?
Attempts:
2 left
💡 Hint
Consider that the same people are measured multiple times under different diets.
✗ Incorrect
Repeated measures ANOVA is used when the same subjects are measured multiple times under different conditions, accounting for within-subject variability.