R Markdown

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(lsr)
library(car) #levene testi için
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
## The following object is masked from 'package:purrr':
## 
##     some
set.seed(1923) #Tekrarlanabilirlik için
deney_grubu<- rnorm(50,mean=45,sd=8) #ilac verilen grup(deney grubu)
kontrol_grubu<- rnorm(50,mean=52,sd=8) #plasebo verilen grup(kontrol grubu)
fare_verisi <-data.frame(grup=rep(c("Deney","Kontrol"),each=50)) %>%
  mutate(süre=round(c(deney_grubu,kontrol_grubu),2))
head(fare_verisi)
##    grup  süre
## 1 Deney 39.81
## 2 Deney 45.56
## 3 Deney 53.49
## 4 Deney 56.08
## 5 Deney 52.47
## 6 Deney 42.59
tail(fare_verisi)
##        grup  süre
## 95  Kontrol 46.23
## 96  Kontrol 59.74
## 97  Kontrol 52.52
## 98  Kontrol 50.93
## 99  Kontrol 62.96
## 100 Kontrol 64.11
fare_istatistik<-fare_verisi %>%
  group_by(grup) %>% 
  summarise(
    N=n(),
    Ortalama=mean(süre),
    Standart_Sapma=sd(süre)
  )
print(fare_istatistik)
## # A tibble: 2 × 4
##   grup        N Ortalama Standart_Sapma
##   <chr>   <int>    <dbl>          <dbl>
## 1 Deney      50     45.2           8.81
## 2 Kontrol    50     52.4           7.92
#Her grup için ayrı ayrı normallik testi
fare_verisi %>% 
  group_by(grup) %>% 
  summarise(shapiro_p=shapiro.test(süre)$p.value)
## # A tibble: 2 × 2
##   grup    shapiro_p
##   <chr>       <dbl>
## 1 Deney       0.409
## 2 Kontrol     0.810
leveneTest(süre~grup,data=fare_verisi)
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to
## factor.
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  1  0.5295 0.4686
##       98
#Bağımsız Örneklem t-testi
sonuc<-t.test(süre~grup,data=fare_verisi,var.equal=TRUE)
print(sonuc)
## 
##  Two Sample t-test
## 
## data:  süre by grup
## t = -4.3425, df = 98, p-value = 3.436e-05
## alternative hypothesis: true difference in means between group Deney and group Kontrol is not equal to 0
## 95 percent confidence interval:
##  -10.601619  -3.951181
## sample estimates:
##   mean in group Deney mean in group Kontrol 
##               45.1614               52.4378
#Cohen's d (Etki Büyüklüğü)
cohensD(süre~grup,data=fare_verisi)
## [1] 0.8685009
ggplot(fare_verisi,aes(x=grup,y=süre,fill=grup))+
  geom_boxplot(width=0.5,color="black",alpha=0.7)+
  theme_minimal()+
  scale_fill_manual(values = c("#2E8B57","#CD5C5C"))+
  labs(title = "ilaç(deney)ve plasebo (kontrol) Gruplarının Labirent Tamamlama Süreleri",
       subtitle = "Deney grubunun daha hızlı olduğu (sürenin düşük olduğu)görülmektedir.",
       x="Grup",y="süre(saniye)")

Yapılan bağımsız örneklem t-testi sonucunda,ilaç verilen deney grubunun labirent tamamlama sürelerinin (\(/bar{x}=45.16,SS=8.81\)),kontrol grubuna göre(\(/bar{x}=52.44,SS=7.92\)) anlamlı derecede daha düşük(hızlı)olduğu saptanmıştır,\(t(98)=-4.34,p<.001,d=0.87\). Bu bulgu,ilaç-X’in mekansal bellek ve öğrenme üzerinde geliştirici bir etkisi olduğunu desteklemektedir.