Exercise 1

The model syntax is identical to the previous one except the fixed effects portion of the model formula is nitro * manage * week instead of nitro * manage + week. We use add_criterion() and loo_compare() to do model comparison as we have done in the past.

karcher_clmm_weekinteraction <- brm(rating ~ nitro * manage * week + (1 | rep:nitro:manage),
                                    family = cumulative(link = 'logit', threshold = 'flexible'),
                                    prior = c(
                                      prior(normal(0, 2), class = b)
                                    ),
                                    data = karcher_long,
                                    seed = 928, file = 'fits/karcher_clmm_weekinteraction')

karcher_clmm_weekinteraction <- add_criterion(karcher_clmm_weekinteraction, 'loo')
karcher_clmm <- add_criterion(karcher_clmm, 'loo')

loo_compare(karcher_clmm, karcher_clmm_weekinteraction)
##                              elpd_diff se_diff
## karcher_clmm_weekinteraction   0.0       0.0  
## karcher_clmm                 -10.2       3.2

We see from the results above that the model including the interactions between treatments and time is a better fit to the data than the model without those interactions. This means we would probably need to produce new prediction plots for this model and carefully examine whether there are biologically meaningful interactions between treatment and time. We might not be able to present the “simplified” result of treatment predictions averaged over weeks, if the effect of treatment depends strongly on week. However that decision is somewhat subjective and relies on your scientific judgment!

Exercise 2

Below is the model formula. If you are a glutton for punishment you could try fitting this model to the Bioscreen data (though I would not be surprised if it is not a great fit)!

bf(
    adjusted_log_OD ~ L * (1 - exp(-k*(HOUR - t0))),
    L ~ compound + (1 | well:rep),
    k ~ 1,
    t0 ~ 1,
    nl = TRUE
  )