Contains the weights by sex (M for male; F for female). The question is whether the average women's weight differs from the average men's weight?
A two-samples independent t-test can be performed to answer to this question.
It is the data set used in the Datanovia tutorial “T-Test in R: One-Sample, Independent (Student & Welch) & Paired” (https://www.datanovia.com/learn/biostatistics/two-groups/t-test-in-r).
data("genderweight")A data frame with 40 rows and 3 columns (stored as a tibble).
participant identifier (1 to 40).
the participant's sex, "F" (female) or "M" (male).
the participant's body weight.
A simulated dataset for teaching the two-samples (independent) t-test.
Datanovia tutorial: T-Test in R: One-Sample, Independent (Student & Welch) & Paired.
data(genderweight)
head(genderweight)
#> # A tibble: 6 × 3
#> id group weight
#> <fct> <fct> <dbl>
#> 1 1 F 61.6
#> 2 2 F 64.6
#> 3 3 F 66.2
#> 4 4 F 59.3
#> 5 5 F 64.9
#> 6 6 F 65.0
# Two-samples independent t-test: do mean weights differ by sex?
t.test(weight ~ group, data = genderweight)
#>
#> Welch Two Sample t-test
#>
#> data: weight by group
#> t = -20.791, df = 26.872, p-value < 2.2e-16
#> alternative hypothesis: true difference in means between group F and group M is not equal to 0
#> 95 percent confidence interval:
#> -24.53135 -20.12353
#> sample estimates:
#> mean in group F mean in group M
#> 63.49867 85.82612
#>