library(palmerpenguins) # for penguin data
library(report) # for reporting stat results (from easystats)
library(tidyverse) # for ggplot
penguins <- penguins
glimpse(penguins)
## Rows: 344
## Columns: 8
## $ species <fct> Adelie, Adelie, Adelie, Adelie, Adelie, Adelie, Adel…
## $ island <fct> Torgersen, Torgersen, Torgersen, Torgersen, Torgerse…
## $ bill_length_mm <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, …
## $ bill_depth_mm <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, …
## $ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186…
## $ body_mass_g <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, …
## $ sex <fct> male, female, female, NA, female, male, female, male…
## $ year <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007…
penguins |>
na.omit() %>%
ggplot(aes(x = sex, y = body_mass_g)) +
geom_boxplot() +
theme_bw()
Yes! That is a very small p value, but how should I report that result in my thesis?
options(scipen= 999) # avoid scientific notation
test <- t.test(body_mass_g ~ sex, data = penguins)
print(test)
##
## Welch Two Sample t-test
##
## data: body_mass_g by sex
## t = -8.5545, df = 323.9, p-value = 0.0000000000000004794
## alternative hypothesis: true difference in means between group female and group male is not equal to 0
## 95 percent confidence interval:
## -840.5783 -526.2453
## sample estimates:
## mean in group female mean in group male
## 3862.273 4545.685
report(test, data = penguins)
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference of body_mass_g by sex (mean
## in group female = 3862.27, mean in group male = 4545.68) suggests that the
## effect is negative, statistically significant, and large (difference = -683.41,
## 95% CI [-840.58, -526.25], t(323.90) = -8.55, p < .001; Cohen's d = -0.94, 95%
## CI [-1.16, -0.71])