AE 05

Author
Affiliation

Moisieiev Vasyl

Kyiv School of Economics

Import

library(tidyverse)

data <- read_csv("https://raw.githubusercontent.com/Aranaur/aranaur.rbind.io/main/datasets/heroes/heroes.csv")

data

Exercise 1

t.test(data$Weight, mu = 100)

    One Sample t-test

data:  data$Weight
t = -11.611, df = 731, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 100
95 percent confidence interval:
 34.36229 53.34809
sample estimates:
mean of x 
 43.85519 

Exercise 2

t.test(data$Height, mu = 185)

    One Sample t-test

data:  data$Height
t = -16.056, df = 733, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 185
95 percent confidence interval:
  92.13644 112.37173
sample estimates:
mean of x 
 102.2541 

Exercise 3

library(dplyr)

black_white_eye_color_heroes <- data %>% 
  filter(`Eye color` %in% c("black", "white"))

t.test(Weight ~ `Eye color`, data = black_white_eye_color_heroes)

    Welch Two Sample t-test

data:  Weight by Eye color
t = -0.74814, df = 35.947, p-value = 0.4592
alternative hypothesis: true difference in means between group black and group white is not equal to 0
95 percent confidence interval:
 -111.76634   51.53105
sample estimates:
mean in group black mean in group white 
            9.00000            39.11765