Homework 9
Homework 9
Due: 2024-04-19, 11:59pm
Submission instructions
For this homework you should submit a ZIP archive containing:
- A single document with the answers to all the following items in HTML format only. Make sure you include plain English blocks in between the code, and its output to interpret what R is giving you.
-
Code file used to generate the answers (RMD format). There should be comments in the code blocks.
- Please remember to mix your comments with code and output.
- Do not forget acknowledgements.
1. Frog abnormalities data (50%)
Use the frog abnormalities data from Reeves et. al. 21 wetland sites in Alaska. Read in the abnormalities file which has information about the individual frogs studied.
- Tabulate the number of frogs per site.
- Fit a fixed effects linear model for predicting the snout-to-vent
length (
SVL
) in each site. - Fit a mixed effects model for snout-to-vent length with a random intercept for each site. How does the variance between sites compare to the variance within sites?
- Fit a mixed effects model for snout-to-vent length using site and whether or not the frog was abnormal. Use a random intercept and a random slope (on abnormalities) in each site. How do abnormalities in a frog affect snout-to-vent length? Does this effect vary across sites?
2. Mouse sleep data (50%)
Use the mouse sleep data from Mannino et al.
- Read in the data. How many unique mice are there? How many are male and how many are female?
- We will focus on the
percent_sleep
variable as the primary outcome of interest. Calculate the averge percent sleep during the light period and dark period for each mouse (L
andD
of the variableLD.Cycle
). Make a scatterplot of the percent sleep in light vs dark period for all mice. Comment. - Fit a mixed effects model for percent sleep with a random intercept and random slope (for the light/dark cycle) per mouse, and fixed effects for sex and light cycle. Is there any evidence that males sleep more or less than females? How much more do mice sleep during the light cycle vs during the dark cycle?
- Is there any evidence that the light/dark cycle effect depends on sex?
3. Acknowledgements
Cite resources or individuals helping you.