We look at the correlation between Milk Consumption per capita and average Men Height from these two sources.
http://en.wikipedia.org/wiki/List_of_countries_by_milk_consumption_per_capita
http://www.averageheight.co/average-male-height-by-country
The data was summarized in file data.csv.
x <- read.table("data.csv", sep = "\t", header = TRUE)
y <- na.omit(x)
head(y)
## Countries Milk Height
## 1 Finland 361.2 1.780
## 2 Sweden 355.9 1.779
## 3 Netherlands 320.1 1.838
## 4 Switzerland 315.8 1.754
## 5 Greece 314.7 1.783
## 7 Lithuania 303.0 1.772
Here is the scatter plot and linear model:
l <- lm(y$Height ~ y$Milk)
plot(y$Milk, y$Height, pch = 19)
abline(l, lwd = 3, col = "red")
cc <- cor.test(y$Milk, y$Height)
cc
##
## Pearson's product-moment correlation
##
## data: y$Milk and y$Height
## t = 5.133, df = 54, p-value = 3.997e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3646 0.7262
## sample estimates:
## cor
## 0.5726
The milk consumption explains
cor(y$Milk, y$Height)^2 * 100
## [1] 32.79
percent in variability of the height.