Exercise 1

yield ~ temperature + rainfall + temperature:rainfall + (1 | block)

Exercise 2

fish_fillets %>% 
  group_by(species) %>% 
  summarize(hardness = mean(hardness, na.rm = TRUE), 
            thickness = mean(thickness, na.rm = TRUE))

Channel has higher mean hardness and thickness.

Exercise 3

fit <- lmer(thickness ~ species + (1|fishID), data = fish_fillets)
check_model(fit)
summary(fit)
anova(fit)

The diagnostic plots show that the residuals and the distribution of random effects conform to the assumptions of the linear mixed model. The model summary shows us that the hybrid species has a somewhat lower predicted mean thickness than the channel species, with a p-value of 0.02 associated with the t-value of the species coefficient. Incidentally, the ANOVA table you get by calling anova(fit) gives the same p-value because with only two discrete groups the F-test is equivalent to the t-test.

Exercise 4

fit <- lmer(thickness ~ hardness + (1|fishID), data = fish_fillets)
check_model(fit)
summary(fit)
anova(fit)

As in the previous exercise, the diagnostic plots show that the residuals and the distribution of random effects conform to the assumptions of the linear mixed model. The model summary shows us that there is a positive relationship between hardness and thickness: for every increase of 1 unit of hardness, there is on average an increase of 0.0036 units of thickness. Also as in the previous exercise, the default t-test gives us the same p-value (\(5.75 \times 10^{-7}\)) as the F-test we see if we call anova(fit).

Exercise 5

fit <- lmer(thickness ~ species + prep + species:prep + (1|fishID), data = fish_fillets)
check_model(fit)
summary(fit)
anova(fit)

Once again the diagnostic plots show everything conforms to model assumptions. The model summary has a lot more coefficients, it shows that there are overall differences between preparation methods. The interaction coefficients between species and preparation method indicate that the negative effect of the frozen and raw preparation methods on thickness is not as big in the hybrid species.