library(tidyverse)
library(effectsize)
library(emmeans)
Homework 6
In a study1, female mice were randomly assigned to four treatment groups to investigate whether restricting dietary intake increases life expectancy:
[NP] mice ate unlimited amount of nonpurified, standard diet
[N/N85] normal diet before weaning and normal diet after weaning (85 kcal/wk)
[N/R50] normal diet before weaning and reduced calorie diet after weaning (50 kcal/wk)
[N/R40] normal diet before weaning and reduced diet after weaning (40 Kcal/wk)
The
longevity
dataset contains observations of lifetime in weeks for 237 mice from the study described above. In this problem you’ll test whether diet restriction has an effect on longevity.- Make side-by-side boxplots of the lifespan data in each treatment group. Assess whether the model assumptions for ANOVA seem plausible.
- Compute summary statistics by treatment group: sample means, standard deviations, sample sizes, and standard errors for the sample means.
- Test for an effect of diet restriction on mean lifespan. Interpret the result of the test in context following the narrative format from class.
- Estimate the effect size of diet restriction on mean lifespan; provide and interpret a (two-sided) 95% confidence interval.
# read in data and preview
load('data/longevity.RData')
# part a: side-by-side boxplots
# part b: summary statistics by treatment group
# part c: omnibus test for effect of diet on mean lifespan
# part d: estimate effect size
- [your answer here]
- (no written answer necessary)
- [your answer here]
- [your answer here]
Imagine you are designing a follow up study on dietary restriction.
- If there are the same number of levels of dietary restriction as in the original study, how many mice per group would you need to detect an effect size of
80% of the time using a 5% level test? - If there are only two levels of dietary restriction, and you want to detect a difference in mean lifespan of 1 week or more 90% of the time using a 5% level test, how many mice do you need in your study? (Round the largest standard deviation from the original study to the next nearest whole number for a conservative estimate.)
- If there are six levels of dietary restriction, how many mice per group would you need to detect an effet of the same magnitude as estimated in the original study 85% of the time with a 5% level test?
- If there are the same number of levels of dietary restriction as in the original study, how many mice per group would you need to detect an effect size of
# part a: same number of levels, effect size 0.2
# part b: two levels, difference of 2 weeks
# part c: six levels, effect size same as in original study
- [your answer here]
- [your answer here]
- [your answer here]
- [Extra credit] Continuing to refer to the longevity study above, follow the example from lecture to compute interval estimates for log-contrasts and back-transform interval endpoints to obtain estimates for the percent change in median lifespan relative to the control group. Report the comparison between the normal (N/N85) diet and the unrestricted (NP) diet. (Note:
log(...)
in R computes the natural logarithm by default; the functionexp(...)
computes the exponential by default; the two are inverses.)
# load data
load('data/longevity.RData')
# fit anova model to log lifetimes
# estimate contrasts with control
# back-transform point estimate for n85/np contrast
# back-transform interval estimates
[your answer here]
The
plantgrowth
dataset includes measurements of dry weight of plants grown using one of two fertilizer treatments or no fertilizer (control); treatments were randomly allocated to plants.- Construct side-by-side boxplots of the data to assess ANOVA model assumptions.
- Fit an ANOVA model and test for a difference in mean dry weight among treatment groups at the 5% significance level. Report the results in context following conventional style.
- Estimate the effect size of fertilizer treatments on dry weight; provide a two-sided 95% confidence interval and interpret the interval in context.
- Test for significant differences in mean dry weight between each treatment compared with the control at the 5% level. Identify any significant differences.
- How do you explain the apparent discrepancy between the omnibus test and the post-hoc comparisons?
# load and inspect data
load('data/plantgrowth.RData')
# construct side-by-side boxplots
# fit anova model and perform omnibus test
# estimate effect size
# test for contrasts with control
- [your answer here]
- [your answer here]
- [your answer here]
- [your answer here]
- [your answer here]
Footnotes
Weindruch, R., Walford, R.L., Fligiel, S. and Guthrie D. (1986). The Retardation of Aging in Mice by Dietary Restriction: Longevity, Cancer, Immunity and Lifetime Energy Intake, Journal of Nutrition 116(4):641–54.↩︎