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.

LS0tCnRpdGxlOiAiRXhlcmNpc2UgOC4xOiBBZGRpdGl2ZSBsaW5lYXIgbW9kZWwgb24gdGhlIHBvaXNvbiBkYXRhc2V0IgphdXRob3I6ICJMaWV2ZW4gQ2xlbWVudCBhbmQgSmVyb2VuIEdpbGlzIgpkYXRlOiAic3RhdE9taWNzLCBHaGVudCBVbml2ZXJzaXR5IChodHRwczovL3N0YXRvb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