Challenge - 5 Problems
t-test Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a one-sample t-test in R
What is the output of this R code snippet?
R Programming
set.seed(123) x <- rnorm(10, mean=5, sd=2) t.test.result <- t.test(x, mu=5) round(t.test.result$p.value, 3)
Attempts:
2 left
💡 Hint
Check the p-value from the t.test object and round it to 3 decimals.
✗ Incorrect
The t.test compares the sample mean to mu=5. The p-value is about 0.564 after rounding.
🧠 Conceptual
intermediate2:00remaining
Understanding paired t-test in R
Which option correctly describes what this R code does?
R Programming
before <- c(200, 195, 210, 190, 205) after <- c(198, 192, 215, 188, 207) t.test(before, after, paired=TRUE)
Attempts:
2 left
💡 Hint
Look at the paired=TRUE argument and the two vectors before and after.
✗ Incorrect
The paired=TRUE argument tells R to do a paired t-test comparing the two related samples.
🔧 Debug
advanced2:00remaining
Identify the error in this two-sample t-test code
What error will this R code produce?
R Programming
group1 <- c(5, 7, 8, 6) group2 <- c(6, 9, 7) t.test(group1, group2, paired=TRUE)
Attempts:
2 left
💡 Hint
Check the lengths of group1 and group2 when paired=TRUE.
✗ Incorrect
Paired t-test requires both vectors to have the same length because it compares pairs element-wise.
❓ Predict Output
advanced2:00remaining
Output of Welch Two Sample t-test in R
What is the output of this R code snippet?
R Programming
set.seed(42) g1 <- rnorm(15, mean=10, sd=3) g2 <- rnorm(20, mean=12, sd=5) test <- t.test(g1, g2) round(test$statistic, 2)
Attempts:
2 left
💡 Hint
Check the t-statistic value from the test object and round to 2 decimals.
✗ Incorrect
The t-statistic is negative because g1 mean is less than g2 mean. The rounded value is about -1.45.
📝 Syntax
expert2:00remaining
Identify the syntax error in this t-test code
Which option contains the syntax error that will cause R to fail running the code?
Attempts:
2 left
💡 Hint
Look for missing commas between arguments.
✗ Incorrect
Option D is missing a comma between mu=5 and alternative='greater', causing a syntax error.