# Install negligible if needed (uncomment lines below if not installed)
# install.packages("negligible")
# install.packages("effectsize")
# install.packages("dplyr")
library(negligible)
library(effectsize)
library(dplyr)
# Import data and name it perfectionism
perfectionism <- read.csv("Assignment2_data.csv")
# Alternatively, if the CSV is unavailable:
# library(negligible)
# data(perfectionism)
# Preview the data
head(perfectionism)
## group mpshfpre.sop mpshfpre.spp pcipre.total baipre.total cesdpre.total
## 1 CBT Group 89 57 78 13 35
## 2 CBT Group 83 70 52 21 37
## 3 CBT Group 89 76 88 33 31
## 4 CBT Group 89 57 78 13 35
## 5 CBT Group 89 59 57 9 19
## 6 CBT Group 83 79 43 8 20
## mpsfpre.cm mpshfpost.sop mpshfpost.spp pcipost.total baipost.total
## 1 30 82 50 57.00000 15
## 2 33 47 30 34.00000 10
## 3 30 64 71 67.00000 16
## 4 30 82 50 57.00000 15
## 5 31 70 57 57.04298 6
## 6 33 78 60 26.00000 4
## cesdpost.total mpsfpost.cm atqpre.total atqpost.total mpshfpre.oop
## 1 32 28 93 73 74
## 2 19 18 66 42 74
## 3 12 26 88 69 68
## 4 32 28 93 73 74
## 5 24 23 58 44 65
## 6 14 23 82 51 75
## mpshfpost.oop
## 1 69
## 2 42
## 3 66
## 4 69
## 5 65
## 6 67
# Subset to CBT group only
cbt <- perfectionism %>% filter(group == "CBT Group")
# Confirm group and variable of interest
nrow(cbt) # should be 30
## [1] 30
summary(cbt$mpshfpost.spp)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 30.00 50.00 55.50 55.99 63.00 73.00
# Shapiro-Wilk test for normality
shapiro.test(cbt$mpshfpost.spp)
##
## Shapiro-Wilk normality test
##
## data: cbt$mpshfpost.spp
## W = 0.96944, p-value = 0.5239
# QQ plot for visual inspection
qqnorm(cbt$mpshfpost.spp, main = "Q-Q Plot: SPP Scores After CBT")
qqline(cbt$mpshfpost.spp, col = "steelblue", lwd = 2)
# Histogram
hist(cbt$mpshfpost.spp,
main = "Histogram: SPP Scores After CBT",
xlab = "SPP Post Score",
col = "lightblue",
border = "white")
Interpretation:
If the p-value is greater than α = .10, we fail to reject the
null hypothesis of normality, meaning the normality assumption is met.
We also examine the plot: if the points fall approximately along the
line, normality is supported. Based on these results, we conclude
normality is met.
# The clinical threshold (mu) is 60
mu <- 60
# Cohen's d for one-sample (distance from the mean to the threshold, scaled by SD)
# Cohen's d = (mean - mu) / SD
mean_spp <- mean(cbt$mpshfpost.spp)
sd_spp <- sd(cbt$mpshfpost.spp)
n_cbt <- nrow(cbt)
cohens_d <- (mean_spp - mu) / sd_spp
cat("Cohen's d:", round(cohens_d, 3), "\n")
## Cohen's d: -0.366
# Interpret: negative d means the mean is below the threshold (desired direction)
# |d|: small = .2-.5, medium = .5-.8, large = .8+
Interpretation:
Cohen’s d = −0.367, indicating a small effect. Post-CBT SPP scores fell
below the clinical threshold of 60, suggesting CBT produced a small but
meaningful reduction in socially-prescribed perfectionism.
# One-sample t-test (two-sided) at 90% CI level
# Note: t.test with conf.level = 0.90 gives a 90% CI for the mean
ci_result <- t.test(cbt$mpshfpost.spp, mu = 60, conf.level = 0.90)
cat("Mean SPP after CBT:", round(mean(cbt$mpshfpost.spp), 3), "\n")
## Mean SPP after CBT: 55.987
cat("90% Confidence Interval: [",
round(ci_result$conf.int[1], 3), ",",
round(ci_result$conf.int[2], 3), "]\n")
## 90% Confidence Interval: [ 52.59 , 59.384 ]
Interpretation:
The mean SPP score after CBT was M = 55.99, 90% CI [52.59, 59.38]. The
confidence interval has a width of approximately 6.79 points, which is
relatively narrow, indicating reasonably good precision in estimating
the population mean.
# One-tailed (one-sided) t-test: testing if spp post-CBT < 60
# H0: mu >= 60
# H1: mu < 60 (one-tailed, lower tail)
nhst_result <- t.test(cbt$mpshfpost.spp,
mu = 60,
alternative = "less", # directional: scores < 60
conf.level = 0.90)
print(nhst_result)
##
## One Sample t-test
##
## data: cbt$mpshfpost.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
Hypotheses:
Decision Rule:
Using α = .10 and a one-tailed test, we reject H₀ if p <
.10.
Results:
t(29) = -2.007, p = 0.027.
Decision:
Since p = .027 < α = .10, we reject H₀. There is sufficient evidence
to conclude that the mean SPP score after CBT is significantly less than
the clinical cut-off of 60. ```