---
# System prepended metadata

title: zad 3

---


# zad 3
![](https://i.imgur.com/WNdNXUQ.png)
```
p <- 20/49
p0 <- 0.2
stdev <- sqrt(p0*(1-p0))
alpha <- 0.02
n <- 49
Z <- (p - p0) / stdev * sqrt(n)
    Z
    # one tailed criterion
    qnorm(alpha)
    # two tiled criterion
    qnorm(alpha / 2)
```
# zad4
![](https://i.imgur.com/p5LuWpu.png)
###a
1- (alpha/2) = 0.9

ro(0.9) = **1.28**
###b
1.28 * sqrt(wariancja) / sqrt(n)
###b, c, d
```
stdev <- 2
alpha <- 0.2
mean <- 3
n <- 100
# left ending
left <- mean - qnorm(1-alpha/2) * (stdev / sqrt(n))
# right ending
right <- mean + qnorm(1 - alpha / 2) * (stdev / sqrt(n))

qnorm(0.9)
(right - left) / 2
left
right
```
# zad 5
![](https://i.imgur.com/S6kU282.png)
```
dane <- c(9, 7, 4, 10, 7, 5, 7)

sorted <- sort(dane)


getmode <- function(v) {
   uniqv <- unique(v)
   uniqv[which.max(tabulate(match(v, uniqv)))]
}

get_qua <- function(i) {
    sorted[((i/4)*(length(dane)+1))]
}

"srednia"
mean(dane)
"mediana"
median(dane)
"dominanta"
getmode(dane)
"rozstep kwartylowy"
get_qua(3) - get_qua(1)
"suma odchylen"
sum(dane) - length(dane)*mean(dane)
```

