load("data/arabidopsis.obj")
7 Exercise: Arabidopsis
To practice we will use an adapted data set on Arabidopsis from Banta, Stevens and Pigliucci (2010 Oikos 119(2), 359-369).
This growth chamber experiment is about the impact of removing the apical meristem and nutrient level on rosette growth and fruit formation.
You can download the data set here. It is stored as an R object. Store it on your computer
You can load it with with something like:
In this exercise we focus on the rosette area.
The task is:
- Find out from the data how the experiment is set up.
- Comment on the set-up and the contribution of the factors
- Fit an appropriate mixed effect model
- Provide a meaningful summary of the analysis
- Make conclusions about the main goal(s) of the experiment
- Comment on possible improvements of similar experiment in the future
Some of the code is hidden behind the buttons below. Don’t reveal the solutions unless you really stuck
click to see a solution: exploration
library(tidyverse)
str(arabidopsis)
<- arabidopsis %>% mutate(rack = as.factor(rack))
arabidopsis
%>% pivot_wider(id_cols=genotype,
arabidopsis names_from = population,
values_from = rosette.area,
values_fn = length) %>%
print(n=30)
click to see a solution: graphical exploration
ggplot(arabidopsis,aes(y=rosette.area,x=interaction(clipping, nutrient))) +
geom_point(aes(color=rack)) +
facet_wrap(~region+population)
click to see a solution: modelling
library(lme4)
<- lmer(data=arabidopsis,
m1.ara.ros ~ clipping*nutrient + (1|region/population/genotype) + (1|rack)
rosette.area
)
summary(m1.ara.ros)
suppressWarnings(confint(m1.ara.ros,quiet=TRUE)) # ignore the warnings...
# drop genotype
<- lmer(data=arabidopsis,
m2.ara.ros ~ clipping*nutrient + (1|region/population) + (1|rack)
rosette.area
)
summary(m2.ara.ros)
suppressWarnings(confint(m2.ara.ros,quiet=TRUE))
# simpler model: drop the interaction in the fixed effects
<- lmer(data=arabidopsis,
m3.ara.ros ~ clipping + nutrient + (1|region/population) + (1|rack)
rosette.area
)
anova(m2.ara.ros,
m3.ara.ros)
click to see a solution: confidence intervals and plotting
<- arabidopsis %>% select(clipping,nutrient) %>% distinct()
predframe
<- function(mod) predict(mod,newdata=predframe,re.form=NA)
bootfun
<- bootMer(m2.ara.ros,FUN=bootfun,nsim=500)
bs
<- bind_cols(predframe,apply(bs$t,2,quantile,c(0.5,0.025,0.975)) %>% t() %>% as_tibble())
out
out
ggplot(out,aes(y=`50%`,x=nutrient,group=clipping,colour=clipping)) +
geom_point(position=position_dodge(width=.2)) +
geom_errorbar(aes(ymin=`2.5%`,ymax=`97.5%`),width=.2,position=position_dodge(width=.2)) +
theme_bw() + ylab("rosette area") + xlab("nutrient")