library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.5.2
## Warning: package 'ggplot2' was built under R version 4.5.2
## Warning: package 'tidyr' was built under R version 4.5.2
## Warning: package 'readr' was built under R version 4.5.2
## Warning: package 'purrr' was built under R version 4.5.2
## Warning: package 'stringr' was built under R version 4.5.2
## Warning: package 'forcats' was built under R version 4.5.2
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.2.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(rstatix)
## Warning: package 'rstatix' was built under R version 4.5.3
## 
## Attaching package: 'rstatix'
## 
## The following object is masked from 'package:stats':
## 
##     filter
set.seed(123)
once <- round(rnorm(25, 12, 3), 1)
sonra <- round(rnorm(25, 16, 3), 1)

veri_bagimli <- data.frame(
  Id = 1:25,
  Once = once,
  Sonra = sonra
)
shapiro_test(once)
## # A tibble: 1 × 3
##   variable statistic p.value
##   <chr>        <dbl>   <dbl>
## 1 once         0.968   0.589
shapiro_test(sonra)
## # A tibble: 1 × 3
##   variable statistic p.value
##   <chr>        <dbl>   <dbl>
## 1 sonra        0.977   0.811
t.test(veri_bagimli$Once, veri_bagimli$Sonra, paired = TRUE)
## 
##  Paired t-test
## 
## data:  veri_bagimli$Once and veri_bagimli$Sonra
## t = -6.2361, df = 24, p-value = 1.912e-06
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -5.87219 -2.95181
## sample estimates:
## mean difference 
##          -4.412
veri_uzun <- veri_bagimli %>%
  pivot_longer(cols = c(Once, Sonra), names_to = "Zaman", values_to = "Skor")
veri_uzun %>% cohens_d(Skor ~ Zaman, paired = TRUE)
## # A tibble: 1 × 7
##   .y.   group1 group2 effsize    n1    n2 magnitude
## * <chr> <chr>  <chr>    <dbl> <int> <int> <ord>    
## 1 Skor  Once   Sonra    -1.25    25    25 large
ggplot(veri_uzun, aes(x = Zaman, y = Skor, fill = Zaman)) +
  geom_boxplot() +
  theme_minimal()