---
title: "puff4"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Opgave 1

N = 80
Y = 50

```{r}
50/80

prop.test(50, 80)

prop.test(50, 80, p=0.65)


```


# Opgave 2


```{r}
# Mødre over 40
21 / (21 + 255)

# Mødre < 30
70 / (70 + 3825)

```


```{r}
p1 <- 21 / (21 + 255)
p2 <- 70 / (70 + 3825)

rd <- p1 - p2
rd

rr <- p1/p2
rr

m <- matrix(c(21, 70, 255, 3825), 2)
m

prop.table(m, 1)

chisq.test(m)

p1/(1-p1) / (p2 / (1-p2))

fisher.test(m)


```

# Opgave 3

```{r}
m <- cbind(c(547, 458, 552, 236, 365), 
           c(395, 304, 261, 117, 301), 
           c(251, 212, 165, 80, 127))
m

prop.table(m, 1)

chisq.test(m)

m2 <- cbind(m[,1]+m[,2], m[,3])
m2

```



