The prior and after-training scores of 10 candidates are given. Test whether training is effective.
prior <- c(84, 48, 36, 37, 54, 69, 83, 96, 90, 65)
after <- c(90, 58, 56, 49, 62, 81, 84, 86, 84, 75)
data.frame(Candidate = 1:10, Prior = prior, After = after, Improvement = after - prior)
## Candidate Prior After Improvement
## 1 1 84 90 6
## 2 2 48 58 10
## 3 3 36 56 20
## 4 4 37 49 12
## 5 5 54 62 8
## 6 6 69 81 12
## 7 7 83 84 1
## 8 8 96 86 -10
## 9 9 90 84 -6
## 10 10 65 75 10
result <- t.test(after, prior, paired = TRUE, alternative = "greater")
result
##
## Paired t-test
##
## data: after and prior
## t = 2.215, df = 9, p-value = 0.027
## alternative hypothesis: true mean difference is greater than 0
## 95 percent confidence interval:
## 1.086091 Inf
## sample estimates:
## mean difference
## 6.3
if (result$p.value < alpha) {
cat("Decision: Reject H0 at 5% significance level.\n")
cat("Conclusion: Training is effective (mean score increased significantly).")
} else {
cat("Decision: Fail to reject H0 at 5% significance level.\n")
cat("Conclusion: Not enough evidence to claim training effectiveness.")
}
## Decision: Reject H0 at 5% significance level.
## Conclusion: Training is effective (mean score increased significantly).