Wilcoxon Signed Rank Testi

Egzersiz yapmayan psikoloji öğrencilerine uygulanan psikoeğitim programı, stres düzeylerini anlamlı biçimde düşürür mü?

Bağımlı değişken: Stres puanı

Olcum zamanlari: - Program öncesi - Program sonrasi

Paketlerin Yuklenmesi

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
library(broom)
library(ggplot2)

Bu bolumde analiz icin gerekli paketler yuklenmistir. tidyverse veri duzenleme islemleri icin, ggplot2 grafik olusturma icin, broom ise test sonucunu daha duzenli gostermek icin kullanilmistir.

Veri Setinin Oluşturulması

stres_veri <- data.frame(
  id = 1:8,

  program_oncesi = c(
    25, 28, 30, 27,
    26, 29, 31, 28
  ),

  program_sonrasi = c(
    22, 25, 27, 24,
    23, 26, 28, 25
  )
)

stres_veri
##   id program_oncesi program_sonrasi
## 1  1             25              22
## 2  2             28              25
## 3  3             30              27
## 4  4             27              24
## 5  5             26              23
## 6  6             29              26
## 7  7             31              28
## 8  8             28              25

Bu kodlarda psikoeğitim programi öncesi ve sonrasi stres puanlari ayni veri seti icinde tanimlanmistir.

id degiskeni her ogrenciyi temsil etmektedir.

program_oncesi degiskeni psikoeğitim öncesindeki stres puanlarini, program_sonrasi degiskeni ise psikoeğitim sonrasindaki stres puanlarini gostermektedir.

Veriyi Uzun Formata Çevirmek

veri_long <- stres_veri %>%

  pivot_longer(
    cols = c(program_oncesi, program_sonrasi),

    names_to = "zaman",

    values_to = "stres"
  )

veri_long
## # A tibble: 16 × 3
##       id zaman           stres
##    <int> <chr>           <dbl>
##  1     1 program_oncesi     25
##  2     1 program_sonrasi    22
##  3     2 program_oncesi     28
##  4     2 program_sonrasi    25
##  5     3 program_oncesi     30
##  6     3 program_sonrasi    27
##  7     4 program_oncesi     27
##  8     4 program_sonrasi    24
##  9     5 program_oncesi     26
## 10     5 program_sonrasi    23
## 11     6 program_oncesi     29
## 12     6 program_sonrasi    26
## 13     7 program_oncesi     31
## 14     7 program_sonrasi    28
## 15     8 program_oncesi     28
## 16     8 program_sonrasi    25

Bu bolumde veri seti uzun formata cevrilmistir.

pivot_longer() fonksiyonu sayesinde program öncesi ve sonrasi puanlar tek bir sutunda toplanmistir.

Bu islem grafik cizimini daha kolay hale getirmektedir.

Çizgi Grafiği

ggplot(
  veri_long,

  aes(
    x = zaman,
    y = stres,
    group = id
  )
) +

  geom_line(alpha = 0.4) +

  geom_point(size = 2) +

  labs(
    title = "Program Oncesi ve Sonrasi Stres",
    x = "Zaman",
    y = "Stres"
  ) +

  theme_minimal()

Bu grafik her ogrencinin program öncesi ve sonrasi stres puanlarini gostermektedir.

Cizgilerin genel olarak asagi dogru ilerlemesi, psikoeğitim programi sonrasinda stres puanlarinin azaldigini gostermektedir.

Kutu Grafiği

ggplot(
  veri_long,

  aes(
    x = zaman,
    y = stres,
    fill = zaman
  )
) +

  geom_boxplot(alpha = 0.6) +

  geom_jitter(
    width = 0.1,
    alpha = 0.6
  ) +

  theme_minimal()

Kutu grafigi incelendiginde program sonrasi stres puanlarinin daha dusuk oldugu gorulmektedir.

Bu durum psikoeğitim programinin stres duzeyi uzerinde etkili olabilecegini dusundurmektedir.

Wilcoxon Signed Rank Testi

sonuc_stres <- wilcox.test(

  stres_veri$program_oncesi,

  stres_veri$program_sonrasi,

  paired = TRUE
)

sonuc_stres
## 
##  Wilcoxon signed rank exact test
## 
## data:  stres_veri$program_oncesi and stres_veri$program_sonrasi
## V = 36, p-value = 0.007812
## alternative hypothesis: true location shift is not equal to 0

Bu bolumde Wilcoxon Signed Rank testi uygulanmistir.

Bu test ayni bireylerin iki farkli zamandaki puanlarini karsilastirmak icin kullanilir.

paired = TRUE ifadesi olcumlerin bagimli oldugunu belirtmektedir.

Test sonucunda p degeri .05’ten kucuk bulunursa program öncesi ve sonrasi puanlar arasinda anlamli bir fark oldugu soylenebilir.

Test Sonucunu Tablo Halinde Gosterme

wilcox.test(
  stres_veri$program_oncesi,

  stres_veri$program_sonrasi,

  paired = TRUE
) %>%

  tidy()
## # A tibble: 1 × 4
##   statistic p.value method                          alternative
##       <dbl>   <dbl> <chr>                           <chr>      
## 1        36 0.00781 Wilcoxon signed rank exact test two.sided

tidy() fonksiyonu test sonucunu daha duzenli bir tablo halinde gostermektedir.

Bu sayede test istatistigi ve p degeri daha kolay okunabilmektedir.

Sonuc ve Yorum

Wilcoxon Signed Rank testi sonucunda program öncesi ve sonrasi stres puanlari arasinda anlamli bir fark bulunmustur.

Test sonucuna gore:

V = 36, p < .05

Bu sonuca gore psikoeğitim programi sonrasinda ogrencilerin stres puanlari azalmistir.

Yani uygulanan psikoeğitim programinin stres duzeyini azaltmada etkili oldugu soylenebilir.

Raporlama

Psikoeğitim programi öncesi ve sonrasi stres puanlari arasindaki farki incelemek amaciyla Wilcoxon Signed Rank testi uygulanmistir.

Analiz sonucunda program öncesi ve sonrasi stres puanlari arasinda istatistiksel olarak anlamli bir fark bulunmustur, V = 36, p < .05.

Bu bulguya gore psikoeğitim programinin stres duzeyini azaltmada etkili oldugu dusunulebilir.