```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
download.file('https://wkristan.github.io/template.docx', 'template.docx', mode = 'wb')
```

## Analysis of variance (ANOVA)

To review ANOVA, we have data on weight gain in Daphnia fed on cyanobacteria. Import the data into a data frame called "anova"

```{r daphnia.import.data}



```

To graph the group means and error bars we need to summarize the data. Load the Rmisc library, and use summarySE() to get means, standard errors, and confidence intervals for these data:

```{r daphnia.sumstats}



```

#### Question: what is the null hypothesis for an ANOVA?

> 

Plot the means and error bars:

```{r daphnia.plot.means}



```

#### Question: based on the graph does it appear that adaptation to cyanobacteria toxins is having the expected effect? How do you know?

> 

Test for normality:

```{r daphnia.normality}



```

#### Question: do we meet the normality assumption for all three groups? How do you know?

> 

Test for HOV:

```{r daphnia.hov}



```

#### Question: do we meet the HOV assumption? How do you know?

> 

Run the ANOVA:

```{r daphnia.run.anova}




```

#### Question: do we reject the null hypothesis? How do you know?

> 

#### Question: what do you know about differences between the three densities at this stage?

> 

Run a Tukey HSD procedure to evaluate which means are different from which:

```{r daphnia.tukey}



```

#### Question: which means are differnet from which?

> 

## Simple linear regression

These data represent an experiment on the effects of environmental temperature on body temperature, measured in the thorax or in the abdomen of winter moths. We will use simple linear regression to evaluate how body temperature is affected by environmental temperature.

#### Question: what is the null hypothesis for a simple linear regression?

> 

#### Question: what should the y-intercept be if the null hypothesis is true?

> 


Import the regression worksheet:

```{r moth.import}



```

Plot the data:

```{r moth.plot}



```

#### Question: which body temperature measurement appears to change when environmental temperature changes?

> 


Run the regressions to get the fitted models:

```{r moth.run.lm}




```

Get the ANOVA tables:

```{r moth.anova.tables}



```

#### Question: which body temperature variable(s) are related to environmental temperature?

> 

Get the coefficients and r2:

```{r moth.regression.coeff}




```

#### Question: what is the slope estimate for thorax temperature? If the null is true what should it be? Is it a problem that it isn't exactly equal to the null hypothetical value?

> 

#### Question: give the regression equation for each model.

> Thorax: 

> Abdomen: 

#### Question: do your regression results support your interpretation of the graphs? In other words, did you get the results you expected given that the graph showed a flat line for thorax temperature and sloped line for abdomen temperature?

> 