Veri Üretim

Burada iki koşullu bir çalışmadan elde edilen verileri simüle edeceğiz. A koşulundaki ortalama 0 ve B koşulundaki ortalama 1’dir.

n <- 100

data <- data.frame(
  id = 1:n,
  condition = c("A", "B") |> rep(each = n/2),
  dv = c(rnorm(n/2, 0), rnorm(n/2, 1))
)

Grafik

library(ggplot2)
ggplot(data, aes(condition, dv))  +
  geom_boxplot(width = 0.25,
               aes(fill = condition),
               show.legend = FALSE)

library(datasets) data(iris)

n <- nrow(iris) # toplam satır sayısı mu <- mean(iris\(Petal.Length) # taç yaprak uzunluğu ortalaması sd <- sd(iris\)Petal.Length) # taç yaprak uzunluğu standart sapması

set.seed(41) simule_deger <- rnorm(n, mu, sd) ___

tac yaprak uzunluğu ortalaması ‘r round(mu,2)’ dir.

analiz

library(dplyr) setosa_petal <- filter(iris, Species == “setosa”) %>% pull(Petal.Length) virginica_petal <- filter(iris, Species == “virginica”) %>% pull(Petal.Length) petal_test <- t.test(setosa_petal, virginica_petal)

rapor edilecek degerleri yorumlama

t <- petal_test\(statistic %>% round(2) df <- petal_test\)parameter %>% round(1) p <- petal_test$p.value %>% round(3) # handle p-values < .001 p_symbol <- ifelse(p < .001, “<”, “=”) if (p < .001) p <- .001

sonucları birleştirme

petal_result <- glue::glue(“t = {t}, df = {df}, p = {p}”) ___

virginica çiçeklerinin yaprakları (\(\overline{x_v}\) = r round(mean(virginica_petal),2)‘) setosa çiçeklerinin yapraklarından (\(\overline{x_s}\)= r round (mean (setosa_petal),2)’) uzundur. ( r petal_result).

###tablo oluşturmak

library(kable)