1 The poison dataset

In this experiment, 96 fish (dojofish, goldfish and zebrafish) were placed separately in a tank with two liters of water and a certain dose (in mg) of the poison EI-43,064. The resistance of the fish against the poison was measured as the amount of minutes the fish survived after being exposed to the poison (Surv_time, in minutes). Additionally, the weight of each fish was measured.

2 Goal

In this tutorial session we will focus on Dojofish, and we will model the survival time in function of the poison dose while correcting for the weight of the fish.

  1. We will first analyse the survival data by only considering the dose as an explanatory variable for survival time

  2. Next we will model the survival data with and additive model for dose and weight

Load libraries

3 Import the data

4 Data tidying

We can see a couple of things in the data that can be improved:

  1. Capitalise the fist column name

  2. Set the Species column as a factor

  3. Change the species factor levels from “0” to Dojofish. Hint: use the fct_recode function.

  4. In the previous analysis on this dataset (Simple linear regression session), we performed a log-transformation on the response variable Surv_time to meet the normality and homoscedasticity assumptions of the linear model. Here, we will immediately work with log-transformed survival times; store these in the new variable log2Surv_time and remove the non-transformed values.

  5. Subset the data to only retain dojofish (species “0”).

5 Data exploration

Prior to the analysis, we should explore our data. To start our data exploration, we will make use of the ggpairs function of the GGally R package. This function will generate a visualization containing multiple panels, which display (1) univariate plots of the different variables in our dataset, (2) bivariate plots and (3) correlation coefficients between the different variables.

6 Question 1: simple linear regression

6.1 Model specification

Describe the model that you will use for this simple linear regression analysis.

6.2 Assess model assumptions

6.3 Inference

Use the model to test the parameters of interest.

6.4 Conclusion

On the transformed and the original scale.

7 Question 2: Analysis with additive effect for weight

7.1 Model specification

Describe the model that you will use for this additive linear model.

7.2 Assess model assumptions

7.3 Inference

Use the model to test the parameters of interest.

7.4 Conclusion

On the transformed and the original scale.

LS0tCnRpdGxlOiAiRXhlcmNpc2UgOC4xOiBBZGRpdGl2ZSBsaW5lYXIgbW9kZWwgb24gdGhlIHBvaXNvbiBkYXRhc2V0IiAgIAphdXRob3I6ICJMaWV2ZW4gQ2xlbWVudCBhbmQgSmVyb2VuIEdpbGlzIgpkYXRlOiAic3RhdE9taWNzLCBHaGVudCBVbml2ZXJzaXR5IChodHRwczovL3N0Y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