---
title: "Group Means"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(Sleuth3)
require(ggplot2)
require(tigerstats)
require(xtable)

fish = case0602
```

First, let's plot the data

```{r exploratory_analysis}
bwplot(Pair~Percentage, data=fish)
densityplot(~Percentage, groups = Pair, auto.key = TRUE, data=fish)
```

We might be wondering whether the length matters, or whether there is a lot of variation between the different male pairs. Let's plot the data:

```{r plotlength}
plot(fish$Length, fish$Percentage)
```

It certainly doesn't look like there is a *linear* trend there.

Let's go back to the boxplot
```{r boxplot}
bwplot(Pair~Percentage, data=fish)
```

Do the variances look equal here?  It looks like there is an outlier.

Let's look at some diagnostic plots
```{r qqplot}
fit <- lm(Percentage~Pair, data=fish)
plot(fit, 1)
plot(fit, 2)
```

There are definitely outliers there -- maybe it's love!


```{r anova}
summary(lm(Percentage~Pair, data=fish))
```

The F-test  doesn't say that the pairs are different.

## So what about the yellow swordtails?

Let's check for normality one last time, and run the test

```{r swordtails}
hist(fish$Percentage)
t.test(mean(Percentage ~ Pair, mu=50, data = fish))
```