Research Scenario 6.4: Physical Activity Program

Research Question

Does participation in a six-week physical activity program significantly change student stress levels?

Students completed a standardized stress questionnaire one week before the program began and again immediately after the program ended.

Because the same students were measured twice, this is a dependent (paired) design.


Hypotheses

Null Hypothesis (H₀):
There is no difference in stress levels before and after the physical activity program.

Alternative Hypothesis (H₁):
There is a difference in stress levels before and after the physical activity program.


Install Required Packages

install.packages(“readxl”) install.packages(“ggpubr”) install.packages(“effectsize”) install.packages(“rstatix”)


Open Packages

library(readxl)
library(effectsize)
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:effectsize':
## 
##     cohens_d, eta_squared
## The following object is masked from 'package:stats':
## 
##     filter

Import Dataset

Dataset6_4 <- read_excel('/Users/sharathnallaganti/Desktop/3rd sem/applied analytics/Dataset6.4.xlsx')

Separate the Data by Condition

Before <- Dataset6_4$Stress_Pre
After  <- Dataset6_4$Stress_Post

Since the same students completed the questionnaire twice, we will compare paired scores.


Create Difference Scores

Differences <- After - Before

Difference scores are used to test the normality assumption required for a dependent t-test.


Descriptive Statistics

mean(Before, na.rm = TRUE)
## [1] 51.53601
median(Before, na.rm = TRUE)
## [1] 47.24008
sd(Before, na.rm = TRUE)
## [1] 17.21906
mean(After, na.rm = TRUE)
## [1] 41.4913
median(After, na.rm = TRUE)
## [1] 40.84836
sd(After, na.rm = TRUE)
## [1] 18.88901

Before the program: - Mean = 51.54 - Median = 47.24 - SD = 17.22

After the program: - Mean = 41.49 - Median = 40.85 - SD = 18.89

On average, stress scores decreased after the program.


Histogram of Difference Scores

hist(Differences,
     main = "Histogram of Difference Scores",
     xlab = "Stress Score Difference (After - Before)",
     ylab = "Frequency",
     col = "blue",
     border = "black",
     breaks = 20)

The histogram appears skewed and not perfectly bell-shaped, suggesting possible non-normality.


Boxplot of Difference Scores

boxplot(Differences,
        main = "Distribution of Score Differences (After - Before)",
        ylab = "Difference in Stress Scores",
        col = "blue",
        border = "darkblue")

The boxplot shows spread and potential deviation from symmetry, supporting the possibility that the data may not be normally distributed.


Shapiro-Wilk Test of Normality

shapiro.test(Differences)
## 
##  Shapiro-Wilk normality test
## 
## data:  Differences
## W = 0.87495, p-value = 0.0008963

W = 0.87495
p = 0.0008963

Interpretation

Because p < .05, the difference scores are not normally distributed.

Therefore, we cannot use a dependent t-test.

We must use the Wilcoxon Signed-Rank Test, which is the non-parametric alternative for paired samples.


Wilcoxon Signed-Rank Test

wilcox.test(Before, After, paired = TRUE)
## 
##  Wilcoxon signed rank exact test
## 
## data:  Before and After
## V = 620, p-value = 2.503e-09
## alternative hypothesis: true location shift is not equal to 0

S V = 620
p = 2.503e-09

Since p < .001, the result is statistically significant.


Effect Size (Rank Biserial Correlation)

df_long <- data.frame(
  id = rep(1:length(Before), 2),
  time = rep(c("Before","After"), each=length(Before)),
  score = c(Before, After)
)

wilcox_effsize(df_long, score ~ time, paired = TRUE)
## # A tibble: 1 × 7
##   .y.   group1 group2 effsize    n1    n2 magnitude
## * <chr> <chr>  <chr>    <dbl> <int> <int> <ord>    
## 1 score After  Before   0.844    35    35 large

Effect size (r₍rb₎) = 0.84
Magnitude = Large


Final Statistical Conclusion

There was a significant difference in stress levels between Before (Mdn = 47.24) and After (Mdn = 40.85),
V = 620, p < .001.

The effect size was large (r₍rb₎ = 0.84).


Overall Conclusion

The six-week physical activity program was effective in significantly reducing student stress levels. The large effect size suggests that the observed reduction was not only statistically significant but also practically meaningful.