Today we learn:

Load packages for today:

library(lmerTest)
## Loading required package: lme4
## Loading required package: Matrix
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
library(ggplot2)

Load data:

download.file("https://timotheenivalis.github.io/data/thorndata.csv", 
              destfile = "data/thorndata.csv")

download.file("https://timotheenivalis.github.io/data/droughtdata.csv", 
                        destfile = "data/droughtdata.csv")

download.file("https://timotheenivalis.github.io/data/roo.csv", 
                        destfile = "data/roo.csv")

download.file("https://timotheenivalis.github.io/data/storks.csv", 
                        destfile = "data/storks.csv")

Visualize

We model the relationship EscapeDistance / Tail_Length.

roo <- read.csv("data/roo.csv")

ggplot(roo, aes(x=Tail_Length, y=EscapeDistance)) + 
  geom_point(aes(color=as.factor(Year)), alpha=0.5) + 
  geom_smooth(method = "lm")
## `geom_smooth()` using formula 'y ~ x'