In this exercise you will:
You need to have installed R, RStudio, and the necessary packages for
the course, including the ELMER
package. See how to
get set up for this course
'data.frame': 8 obs. of 3 variables:
$ Dose : num 1.69 1.72 1.76 1.78 1.81 ...
$ NoBeetles: int 59 60 62 56 63 59 62 60
$ NoKilled : int 6 13 18 28 52 53 61 60
Fit the model \[\mu_Y = \beta_0 + \beta_1 Dose\] to the beetle mortality data using iterative reweighting based on Y having a binomial distribution. Compare the predictions with those from the arcsine transformation.
Beetles = Beetles |> mutate(Prop = NoKilled / NoBeetles)
ModelU =lm(Prop~Dose, data=Beetles)
FitsU=fitted(ModelU)
Beetles = Beetles |> mutate(TProp= asin(sqrt(Prop))) # the arcsine square root transformation for proportions
ModelT=lm(TProp~Dose, data=Beetles)
FitsT=(sin(fitted(ModelT)))^2 # backtransforms fitted values onto the original scale