```{r, setup, include=FALSE}
require(mosaic)
```

# Exercise 1

a. Import data (also available for download at the website):
```{r}
chdcoco <- read.delim("http://asta.math.aau.dk/eng/static/datasets?file=chdcoco.txt")
```

b. Make a contingency table
```{r}
## Write command(s) here.
```

c. Make a new variable called `freq` with the value 1 for all people:
```{r}
chdcoco$freq <- 1
```

d. Use `aggregate` to get the counts when only `adef` are included as factors:
```{r}
adef <- aggregate(freq ~ a + d + e + f, data = chdcoco, FUN = sum)
```

e. Write down the formula for the logarithm of the expected frequency using the parameters of the saturated model for this dataset (`adef`).
$$
y = 
$$

f. Show that 3-way and 4-way interactions are insignificant.
```{r}
## Write command(s) here.
```

g. If possible reduce the model.
```{r}
## Write command(s) here.
```

h.  What is the expected frequency of the combination: a="Yes", d="$\leq 140$", e="$\leq 3$", f="Positive"?


# Exercise 2

