**Full TA Session**

You all should have R and RStudio installed on your computers by now. If you do not, first install the latest version of R here: https://cran.rstudio.com (remember to select the right installer for your operating system). Next, install the latest version of RStudio here: https://www.rstudio.com/products/rstudio/download/. Scroll down to the “Installers for Supported Platforms” section and find the right installer for your operating system.

The goal of this lab is to gauge each student’s level of comfort with doing exploratory data analysis in R! and specifying regression models for small data. Since we are yet to cover any rigorous material, the TA will walk you through (in case you don’t know or have forgotten) how to specify a basic linear regression model to the data below and how to interpret the results. Also, this should be a relatively short lab, so you should use it as an opportunity to figure out the logistics of future labs, that is, check your R/RStudio installation, make sure you know how to work in R markdown and knit to .pdf, and so on.

In a classic *Nature* communication, Partridge and Farquhar argued that there is a physiological cost of reproduction, which is in line with many evolutionary theories. At that time, this cost had been shown experimentally for females, but no cost for sexual activity had been shown for males in which the only paternal contribution to offspring is provision of gametes.

To explore whether there is any effect of sexual activity on lifespan, researchers randomized male fruit flies to one of two groups: an isolated population of males (no sexual activity), or a mixed-gender population in which the male fruit flies were sexually active. Because body size has also been linked to longevity, we consider it here (measured by thorax length) as well.

The data are in the file fruitfly_thorax_len.csv, which contains lifespan, thorax length, and sexual activity for male fruit flies in the experiment.

The TA will walk you through how one would approach the following questions.

- Create two plots:
- the first to explore the relationship between the lifespan (longevity) of the male fruit flies and thorax length; and
- the second to explore the relationship between the lifespan (longevity) of the male fruit flies and sexual activity.

- Create a single plot to visualize the lifespan (longevity) of the male fruit flies as a function of sexual activity but broken down by thorax length. What can you conclude about this plot?
- Specify and fit a two-way ANOVA model without interactions for estimating the association between longevity (your response variable), sexual activity, and thorax length in male fruit flies.
- Interpret the findings using language accessible to a general scientifically-savvy reader (e.g., someone reading a science article in the BBC or CNN apps). Findings should include uncertainty quantification around effect estimates of interest (no point estimates without uncertainty!).
- Investigate the adequacy of model fit and evaluate the suitability of modeling assumptions.

No submissions are required at the end of this lab.