# 1. Importer les données

```{r}
cidre <- read.table("https://r-stat-sc-donnees.github.io/cidre.csv",header=TRUE,sep=";")
summary(cidre[,c(1,2,4)])
```

# 2. Représenter les données

```{r,fig.width=6,fig.height=5}
plot(S.Sucree~S.Amere,col=as.numeric(Type),data=cidre, pch=15)
legend("topright",levels(cidre$Type),fil=1:nlevels(cidre$Type),
       col=1:nlevels(cidre$Type))
for(i in 1:nlevels(cidre$Type)){abline(lm(S.Sucree~S.Amere,
                                          data=cidre[cidre$Type==levels(cidre$Type)[i],]), col=i)}
```

```{r,message=FALSE,warning=FALSE}
library(ggplot2)
ggplot(cidre,aes(y=S.Sucree, x=S.Amere, col=Type)) +
  geom_point() + geom_smooth(method=lm, se=FALSE)
```

# 3. Choix du modèle

```{r,message=FALSE,warning=FALSE}
library(FactoMineR)
complet <- AovSum(S.Sucree~Type+S.Amere+Type:S.Amere,data=cidre)
complet$Ftest
```
```{r}
mod.sans.int <- AovSum(S.Sucree~Type+S.Amere,data=cidre)
mod.sans.int$Ftest
```

```{r}
mod.sans.int$Ttest

```

# Pour aller plus loin

```{r}
complet <- lm(S.Sucree ~ Type + S.Amere + Type:S.Amere, data = cidre)
ModSansInt <- lm(S.Sucree ~ Type + S.Amere, data = cidre)
anova(ModSansInt,complet)
```


