---
title: "Agresti exercises 5.7 and 5.17"
author: ""
date: ""
output: 
  html_document:
    fig_height: 3
    fig_width: 5
  pdf_document:
    fig_height: 3
    fig_width: 5
  word_document:
    fig_height: 3
    fig_width: 5
---

```{r, setup, include=FALSE}
require(mosaic)   # Load additional packages here 

# Some customization.  You can alter or delete as desired (if you know what you are doing).
trellis.par.set(theme=theme.mosaic()) # change default color scheme for lattice
knitr::opts_chunk$set(
  tidy=FALSE,     # display code as typed
  size="small")   # slightly smaller font for code
```


# Agresti exercise 5.7

Load in the data:
```{r}
Agresti.5.7 <- read.delim("https://asta.math.aau.dk/datasets?file=Agresti-5-7.txt")
```

Use `tally` to count the needed results and use **R** as a calculator to answer the questions (a) - (c).

You can check your confidence interval using `prop.test` (note which group is
considered a "success" if the results look surprising -- the argument `succes`
in `prop.test` can be used to change the "success" group to "yes" if you want).


# Agresti exercise 5.17

```{r}
votes400 <- read.delim("https://asta.math.aau.dk/datasets?file=Agresti-5-17-size400.txt")
votes40 <- read.delim("https://asta.math.aau.dk/datasets?file=Agresti-5-17-size040.txt")
```

Use `tally` to count the needed results and use **R** as a calculator to answer the questions (a) - (b).

You can check your confidence intervals using `prop.test` (remember to set the
argument `conf.level` equal to 0.99 to get a 99 % confidence interval).
