Introduction aux statistiques avec R
Maggie Matsui
Content Developer, DataCamp

$$r = 0.18$$
Ce que nous voyons :

Ce que « voit » le coefficient de corrélation :

N'utilisez pas la corrélation à l'aveugle
cor(df$x, df$y)
0.1786163
Visualisez toujours vos données

msleep
name vore sleep_total awake bodywt
1 Cheetah carni 12.1 11.9 50
2 Owl monkey omni 17 7 0.48
3 Mountain beaver herbi 14.4 9.6 1.35
4 Greater short-tailed shrew omni 14.9 9.1 0.019
5 Cow herbi 4 20 600
6 Three-toed sloth herbi 14.4 9.6 3.85
...

cor(msleep$bodywt, msleep$awake)
0.3119801

msleep %>% mutate(log_bodywt = log(bodywt)) %>%ggplot(aes(log_bodywt, awake)) + geom_point() + geom_smooth(method = "lm", se = FALSE)
cor(msleep$log_bodywt, msleep$awake)
0.5687943

log(x))sqrt(x))Transformation réciproque (1 / x)
Combinaisons possibles, p. ex. :
log(x) et log(y)sqrt(x) et 1 / yx est corrélé à y ne veut pas dire x cause y







Introduction aux statistiques avec R