library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.1 ✔ tibble 3.3.0
## ✔ 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) #test çıktısını tabloya çevirmek için kullandık
library(ggplot2) #görselleştirme için kullandık
program_oncesi=c(25,28,30,27,26,29,31,28)
program_sonrası=c(22,25,27,24,23,26,28,25)
stres_veri<-data.frame(
id=1:8,
program_oncesi=c(25,28,30,27,26,29,31,28),
program_sonrası=c(22,25,27,24,23,26,28,25)
)
stres_veri
## id program_oncesi program_sonrası
## 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
veri_long<-stres_veri %>%
pivot_longer(
cols = c(program_oncesi,program_sonrası),
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_sonrası 22
## 3 2 program_oncesi 28
## 4 2 program_sonrası 25
## 5 3 program_oncesi 30
## 6 3 program_sonrası 27
## 7 4 program_oncesi 27
## 8 4 program_sonrası 24
## 9 5 program_oncesi 26
## 10 5 program_sonrası 23
## 11 6 program_oncesi 29
## 12 6 program_sonrası 26
## 13 7 program_oncesi 31
## 14 7 program_sonrası 28
## 15 8 program_oncesi 28
## 16 8 program_sonrası 25
ggplot(veri_long,aes(x=zaman,y=stres,group=id))+
geom_line(alpha=0.4)+
geom_point(size=2)+
labs(title="Program Öncesi ve Sonrası Stres",
x="zaman",
y="stres")+
theme_minimal()
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()
sonuc_stres<- wilcox.test(
stres_veri$program_oncesi,
stres_veri$program_sonrası,
paired = TRUE
)
## Warning in wilcox.test.default(stres_veri$program_oncesi,
## stres_veri$program_sonrası, : cannot compute exact p-value with ties
sonuc_stres
##
## Wilcoxon signed rank test with continuity correction
##
## data: stres_veri$program_oncesi and stres_veri$program_sonrası
## V = 36, p-value = 0.005962
## alternative hypothesis: true location shift is not equal to 0
Wilcoxon Signed-Rank testi sonuçları,psikoeğitim programı sonrasında stres düzeylerinin anlamlı biçimde azaldığını göstermiştir( V=36,P<.O5)