# STAT1013: InClass Practice - A/B Test II
###### Suggested time: **25min**
## Problem 1
It is widely believed that the average body temperature for healthy adults is $37$ degrees Celsius. Is this true? Where did the $37$ value come from?
> In 1868, [Carl Wunderlich](https://en.wikipedia.org/wiki/Carl_Reinhold_August_Wunderlich) published a seminal paper on body temperature in 25,000 adults and they averaged $37$.
A study was conducted in 1992 to examine this belief. The oral body temperatures of $148$ healthy adults were measured (half male and half female) using an electronic digital thermometer. The average temperature from the sample was found to be $\bar{x} = 36.805$ with standard deviation $\widehat{\sigma} = 0.4073$. Do these statistics contradict the belief that the average body temperature is $37$?
:::info
Based on a random sample of 148 adults, $\bar{x} = 36.805$ and $\widehat{\sigma} = 0.4073$. Recall the null and alternative hypothesis:
$$
H_0: \mu = 37, \quad H_a: \mu \neq 37.
$$
:::
- Q1: What is the test statistic we used in this testing?
- Q2: Assuming $H_0$ is correct, what is the probability distribution of test statistic $T$?
- Q3: Calculate the test statistic based on the observed sample mean and sample standard deviation.
- Q4: Calculate and interpret the p-value for this test statistic.
## Problem 2
An experiment was performed to compare the quality of two different materials, and the equal variance is assumed for both materials.
50 pieces of **material 1** were tested by exposing each piece to a machine measuring wear. 60 pieces of **material 2** were similarly tested. In each case, the depth of wear was observed.
The samples of **material 1** gave an average (coded) wear of 85 units with a sample standard deviation of 4, while the samples of **material 2** gave an average of 81 with a sample standard deviation of 5. Can we conclude at the 0.05 level of significance that the abrasive wear of material 1 exceeds that of material 2 by more than 2 units?
## Problem 3 (**optinal**)
Make a python function to conduct a two-sample (or paired) normal test with variances are known.
```python=
def ztest_ind(a, b, sd1, sd2, alternative)
# add your solution
return p_value, test_stat
```
and
```python=
def ztest_1samp(a, sd, popmean, alternative)
# add your solution
return p_value, test_stat
```
## Solution
Solution is provided in [colab](
https://colab.research.google.com/drive/1N0aLkd8M1jYr0b8Jt6YhC2P_H6t2HyIe?usp=sharing).