library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──

✔ dplyr 1.1.4 ✔ readr 2.1.5

✔ forcats 1.0.1 ✔ stringr 1.5.2

✔ ggplot2 4.0.0 ✔ tibble 3.3.0

✔ lubridate 1.9.4 ✔ tidyr 1.3.1

✔ purrr 1.1.0

── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──

✖ dplyr::filter() masks stats::filter()

✖ dplyr::lag() masks stats::lag()

ℹ Use the conflicted package (http://conflicted.r-lib.org/) to force all conflicts to become errors

library(lsr)
library(broom)
library(ggplot2)
egzersiz_yapan <- c(18,20,22,19,17,21,23,20)
egzersiz_yapmayan <- c(25,28,30,27,26,29,31,28)

stres <- c(egzersiz_yapan,egzersiz_yapmayan)
grup <- factor(c(rep("yapan", length(egzersiz_yapan)),
                 rep("yapmayan" , length(egzersiz_yapmayan))))
egzersiz_veri <- data.frame(grup, stres)

egzersiz_veri
##        grup stres
## 1     yapan    18
## 2     yapan    20
## 3     yapan    22
## 4     yapan    19
## 5     yapan    17
## 6     yapan    21
## 7     yapan    23
## 8     yapan    20
## 9  yapmayan    25
## 10 yapmayan    28
## 11 yapmayan    30
## 12 yapmayan    27
## 13 yapmayan    26
## 14 yapmayan    29
## 15 yapmayan    31
## 16 yapmayan    28
sonuc_egzersiz <- wilcox.test(stres ~ grup, data = egzersiz_veri)

Wilcoxon rank sum test with continuity correction

data: stres by grup

W = 0, p-value = 0.0009229

alternative hypothesis: true location shift is not equal to 0

wilcox.test(egzersiz_yapan, egzersiz_yapmayan)
## 
##  Wilcoxon rank sum exact test
## 
## data:  egzersiz_yapan and egzersiz_yapmayan
## W = 0, p-value = 0.0001554
## alternative hypothesis: true location shift is not equal to 0

Warning in wilcox.test.default(egzersiz_yapan, egzersiz_yapmayan): cannot

compute exact p-value with ties

Wilcoxon rank sum test with continuity correction

data: egzersiz_yapan and egzersiz_yapmayan

W = 0, p-value = 0.0009229

alternative hypothesis: true location shift is not equal to 0

wilcox.test(stres ~ grup, data = egzersiz_veri) %>% 
  tidy()
## # A tibble: 1 × 4
##   statistic  p.value method                       alternative
##       <dbl>    <dbl> <chr>                        <chr>      
## 1         0 0.000155 Wilcoxon rank sum exact test two.sided

Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], …): cannot

compute exact p-value with ties

# A tibble: 1 × 4

statistic p.value method alternative

1 0 0.000923 Wilcoxon rank sum test with continuity correct… two.sided

ggplot(egzersiz_veri, aes(x = grup, y = stres, fill = grup)) +
  geom_boxplot(alpha = 0.6) + 
  geom_jitter( width = 0.1, alpha =0.6) +
  labs(title = "egzersiz durumuna göre stres",
       x = "grup",
       y = "stres puanı") + 
  theme_minimal()

Düzenli egzersiz yapan ve yapmayan öğrencilerin algılanan stres düzeyleri arasında anlamlı bir fark bulunmuştur. Mann–Whitney U testi sonucu: W=0, p<.001 Buna göre düzenli egzersiz yapmayan öğrencilerin stres düzeyleri, egzersiz yapan öğrencilere göre daha yüksektir. 5. Raporlama Düzenli egzersiz yapan ve yapmayan öğrencilerin algılanan stres düzeyleri arasında anlamlı bir fark olup olmadığını incelemek amacıyla Mann–Whitney U testi uygulanmıştır. Analiz sonucunda gruplar arasında anlamlı farklılık bulunmuştur, W=0,p<.001. Bulgular, düzenli egzersiz yapmayan öğrencilerin daha yüksek stres düzeyine sahip olduğunu göstermektedir.