-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathweek11.Rmd
44 lines (34 loc) · 1.11 KB
/
week11.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: "Week 11 exercises"
author: "Brad McNeney"
date: '2018-03-29'
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Obtain the data, load packages, set the random seed
We will use a dataset on fruit flies that is made available in the package
`Stat2Data`. Install `Stat2Data` and load the `FruitFlies` dataframe.
You can read about the experiment with `help("FruitFlies")
```{r}
library(Stat2Data)
data("FruitFlies")
library(ggplot2)
library(dplyr)
library(broom)
set.seed(123)
```
## Questions
1. Plot histograms of `Longevity` in separate facets for each level
of the factor `Treatment`. Use a binwidth of 10 for your histograms.
2. Do boxplots of `Longevity` by `Treatment`
3. Calculate sample size, mean and SD of `Longevity` within each
level of `Treatment`.
4. Use `stat_summary()` to
plot 95\% confidence intervals for the mean `Longevity` in each
treatment group.
5. Estimate the permutation distribution for the $F$ test of
treatment effect using 1000 permutations. Compute the p-value
from your permutation distribution and compare to the model-based
p-value.