file_name <- "Assignment2_data.csv"
if (file.exists(file_name)) {
perfectionism <- read.csv(file_name)
} else {
message("CSV not found — opening file browser...")
perfectionism <- read.csv(file.choose())
}
## CSV not found — opening file browser...
cbt <- subset(perfectionism, group == "CBT Group")
spp <- cbt$mpshfpost.spp
mu0 <- 60
shapiro.test(spp)
##
## Shapiro-Wilk normality test
##
## data: spp
## W = 0.96944, p-value = 0.5239
par(mfrow = c(1, 2))
hist(spp, main = "Histogram: Post-CBT SPP Scores", xlab = "SPP Score", col = "lightblue", border = "white")
qqnorm(spp, main = "Q-Q Plot: Post-CBT SPP Scores")
qqline(spp, col = "red")
par(mfrow = c(1, 1))
Interpretation: The Shapiro-Wilk test yields W = 0.969, p = .524. Since p > α = .10, we fail to reject the null hypothesis of normality. The normality assumption is met.
n <- length(spp)
xbar <- mean(spp)
s <- sd(spp)
d <- (xbar - mu0) / s
J <- 1 - (3 / (4 * (n - 1) - 1))
g <- d * J
cat("Cohen's d =", round(d, 3), "\n")
## Cohen's d = -0.366
cat("Hedges' g =", round(g, 3), "\n")
## Hedges' g = -0.357
Interpretation: Cohen’s d = -0.367 and Hedges’ g = -0.357 both fall in the small range (0.2–0.5). Post-CBT SPP scores fall below the clinical threshold, but the magnitude of the difference is modest.
cat("Mean =", round(mean(spp), 2), "\n")
## Mean = 55.99
ci <- t.test(spp, conf.level = 0.90)
cat("90% CI: [", round(ci$conf.int[1], 2), ",", round(ci$conf.int[2], 2), "]\n")
## 90% CI: [ 52.59 , 59.38 ]
Interpretation: The mean post-CBT SPP score is 55.99. The 90% CI [52.59, 59.38] indicates moderate precision. The entire interval falls below the clinical threshold of 60.
t.test(spp, mu = 60, alternative = "less", conf.level = 0.90)
##
## One Sample t-test
##
## data: spp
## t = -2.0073, df = 29, p-value = 0.02706
## alternative hypothesis: true mean is less than 60
## 90 percent confidence interval:
## -Inf 58.60888
## sample estimates:
## mean of x
## 55.98711
t_crit <- qt(0.10, df = n - 1)
cat("t critical =", round(t_crit, 3), "\n")
## t critical = -1.311
Hypotheses: H₀: μ = 60 (post-CBT SPP equals the clinical threshold)
H₁: μ < 60 (post-CBT SPP is less than the clinical threshold)
Decision: t(29) = -2.007, p = .027. Since p < α = .10, we reject H₀. There is sufficient evidence that the mean post-CBT SPP score is significantly less than 60