Introduzione alle statistiche in R

$$r = 0.18$$
Cosa vediamo:

Cosa vede il coefficiente di correlazione:

La correlazione non dovrebbe essere utilizzata alla cieca
cor(df$x, df$y)
0.1786163
Visualizza sempre i tuoi dati

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))Trasformazione reciproca (1 / x)
Combinazioni di questi, ad esempio:
log(x) e log(y)sqrt(x) e 1 / yx è correlato con y non significa che x causa y







Introduzione alle statistiche in R