© 2018 Aaron A. King.
Load the data.
library(readr)
library(ggplot2)
library(magrittr)
library(reshape2)
library(plyr)
library(dplyr)
read_csv("https://kinglab.eeb.lsa.umich.edu/202/vandy/vandy_data.csv",
comment="#") -> dat
unique(dat$species)
## [1] "Bl" "Pa" "Pb" "Pc"
unique(dat$experiment)
## [1] "Bl" "BlPa" "BlPaPbPc" "BlPb" "BlPc" "Pa"
## [7] "PaPb" "PaPc" "Pb" "PbPc" "Pc"
unique(dat$rep)
## [1] 1 2 3 4 5 6 7 8
dat
Focus on just the Paramecium bursaria data, from the single-species experiments.
dat %>%
subset(experiment=="Pb"&species=="Pb",select=-food) %>%
ggplot(aes(x=day,y=count,group=rep))+
geom_line()+
facet_wrap(~rep,ncol=2,labeller=labeller(rep=label_both))+
theme_bw() -> pl
pl
Plotting on the log scale gives a somewhat different perspective.
pl+scale_y_log10()
Let’s plot \(N_t\) vs \(N_{t-1}\).
dat %>%
subset(experiment=="Pb"&species=="Pb",select=-food) %>%
ddply(~rep,mutate,prev=lag(count,1)) %>%
ggplot(aes(x=prev,y=count,group=rep))+
geom_point()+geom_smooth()+
facet_wrap(~rep,ncol=2,labeller=labeller(rep=label_both),scales="free")+
labs(x=expression(N[t-1]),y=expression(N[t]))+
theme_bw()
And \(N_t/N_{t-1}\) vs \(N_{t-1}\).
dat %>%
subset(experiment=="Pb"&species=="Pb",select=-food) %>%
ddply(~rep,mutate,prev=lag(count,1)) %>%
ggplot(aes(x=prev,y=count/prev,group=rep))+
geom_point()+geom_smooth()+
facet_wrap(~rep,ncol=2,labeller=labeller(rep=label_both),scales="free")+
labs(x=expression(N[t-1]),y=expression(N[t]/N[t-1]))+
theme_bw()