Logistic regression
In toxicology studies, organisms are often dosed and binary outcomes often occur such as dead/alive or inhibited/mobile. This is called a dose-response study. For example, the response to different doses might be mortality (1) or survival (0) at the end of a study.
During this exercise, we will fit a logistic regression using all three methods described in the video. You have been given two datasets.
df_long
, in a "long" format with each row corresponding to an observation (i.e., a 0 or 1).df_short
, in an aggregated format with each row corresponding to a treatment (e.g., 6 successes, 4 failures, number of replicates = 10, proportion = 0.6).
When using the "wide" or "short" data frame, the "success, failure" methods for inputing logistic regression results require success and failure be a matrix. The easiest way to do this is with the cbind()
function.
Tip: When working with data in the wild, always check to see what 0
and 1
correspond to. Different people use different notation and assumptions can cause problems for you if you assume wrong!
Cet exercice fait partie du cours
Hierarchical and Mixed Effects Models in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Fit a glm using data in a long format
fit_long <- glm(___ ~ ___, data = df_long,
family = "___")
summary(___)