### R Z-test

Formula for Z Score:
z = √n(x - x0)/σ
Where:
n: Sample number
x: Population mean
x0: Hyposized population mean
σ: Standard Deviation

We hypothesize water volume will not change under X rays. So we checked 100 bottles of drinking water with 300 ml volume, and recorded the volume difference from 300 ml. We will test the Hypothesis H0: σ = 0 against σ ≠ 0.

Data in "tp.txt":

Calculate the Z Score:
```> x <- read.csv("tp.txt",header=F)
> x <- x[1:100,]
> z <- sqrt(100) * (mean(x) - 0)/sd(x)
> z
```
``` -0.2334861
```

Calculate P value:
```> p <- 2 * pnorm(-abs(z),0,1)
> p
```
``` 0.8153839
```

Since p>0.05, we accept the hypothesis.

We then hypothesize water volume will not change under higher temperature at 80 degrees. So we checked 100 bottles of drinking water with 300 ml volume, and recorded the volume difference from 300 ml. We will test the Hypothesis H0: σ = 0 against σ ≠ 0.

Data in "tp.txt":
Calculate the Z Score:
```> x <- read.csv("tp.txt",header=F)
> x <- x[1:100,]
> z <- sqrt(100) * (mean(x) - 0)/sd(x)
> z
```
``` 18.28636
```

Calculate P value:
```> p <- 2 * pnorm(-abs(z),0,1)
> p
```
``` 1.06279e-74
```

Since p < 0.05, the hypothesis is rejected.