# What is the True Normal Human Body Temperature?

#### Background

The mean normal body temperature was held to be 37\$^{\circ}\$C or 98.6\$^{\circ}\$F for more than 120 years since it was first conceptualized and reported by Carl Wunderlich in a famous 1868 book. But, is this value statistically correct?

### Exercises

In this exercise, you will analyze a dataset of human body temperatures and employ the concepts of hypothesis testing, confidence intervals, and statistical significance.

Answer the following questions in this notebook below and submit to your Github account.

1. Is the distribution of body temperatures normal?
• Although this is not a requirement for CLT to hold (read CLT carefully), it gives us some peace of mind that the population may also be normally distributed if we assume that this sample is representative of the population.
2. Is the sample size large? Are the observations independent?
• Remember that this is a condition for the CLT, and hence the statistical tests we are using, to apply.
3. Is the true population mean really 98.6 degrees F?
• Would you use a one-sample or two-sample test? Why?
• In this situation, is it appropriate to use the \$t\$ or \$z\$ statistic?
• Now try using the other test. How is the result be different? Why?
4. Draw a small sample of size 10 from the data and repeat both tests.
• Which one is the correct one to use?
• What do you notice? What does this tell you about the difference in application of the \$t\$ and \$z\$ statistic?
5. At what temperature should we consider someone's temperature to be "abnormal"?
• Start by computing the margin of error and confidence interval.
6. Is there a significant difference between males and females in normal temperature?
• What test did you use and why?
• Write a story with your conclusion in the context of the original problem.

You can include written notes in notebook cells using Markdown:

#### Resources

``````

In [1]:

import pandas as pd

``````
``````

In [2]:

``````
``````

In [3]:

# Load Matplotlib + Seaborn and SciPy libraries
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy import stats
%matplotlib inline

``````
``````

In [4]:

``````
``````

Out[4]:

.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}

.dataframe tbody tr th {
vertical-align: top;
}

text-align: right;
}

temperature
gender
heart_rate

0
99.3
F
68.0

1
98.4
F
81.0

2
97.8
M
73.0

3
99.2
F
66.0

4
98.0
F
73.0

``````

### 1. Is the distribution of body temperatures normal?

Yes. Based on the shape of the curve plotted with sample data, we have a normal distribution of body temperature.

``````

In [5]:

ax = sns.distplot(df[['temperature']], rug=True, axlabel='Temperature (o F)')

``````
``````

``````

### 2. Is the sample size large? Are the observations independent?

Yes. We have 390 records in the sample data file (df.size).
There is no connection or dependence between the measured temperature values, in other words, the observations are independent.

``````

In [6]:

# Sample (dataset) size
df['temperature'].describe()

``````
``````

Out[6]:

count    130.000000
mean      98.249231
std        0.733183
min       96.300000
25%       97.800000
50%       98.300000
75%       98.700000
max      100.800000
Name: temperature, dtype: float64

``````
``````

In [7]:

# Population mean temperature
POP_MEAN = 98.6

# Sample size, mean and standard deviation
sample_size = df['temperature'].count()
sample_mean = df['temperature'].mean()
sample_std = df['temperature'].std(axis=0)

``````

### What we know about population and what we get from sample dataset

``````

In [8]:

print("Population mean temperature (given): POP_MEAN = " + str(POP_MEAN))
print("Sample size: sample_size = " + str(sample_size))
print("Sample mean: sample_mean = "+ str(sample_mean))
print("Sample standard deviation: sample_std = "+ str(sample_std))

``````
``````

Population mean temperature (given): POP_MEAN = 98.6
Sample size: sample_size = 130
Sample mean: sample_mean = 98.24923076923078
Sample standard deviation: sample_std = 0.7331831580389454

``````

### 3. Is the true population mean really 98.6 degrees F?

• Ho or Null hypothesis: Average body temperature is 98.6 degrees F
• Ha or Alternative hypothesis: Average body temperature is not 98.6 degrees F
• ??? How to validate these hypotheis?
``````

In [9]:

# t distribuition
# t = ((sample_mean - reference_value)/ std_deviation ) * sqrt(sample_size)
# ...

``````
``````

In [10]:

# degrees of freedom
degree = 130 - 1

``````
``````

In [12]:

# p-value
# p = stats.t.cdf(t,df=degree)

``````
``````

In [13]:

# t-stats and p-value
# print("t = " + str(t))
# print("p = " + str(2*p))

``````

a) Would you use a one-sample or two-sample test? Why?

• ???

b) In this situation, is it appropriate to use the t or z statistic?

• ???

c) Now try using the other test. How is the result be different? Why?

• ?

### 4. Draw a small sample of size 10 from the data and repeat both tests.

``````

In [54]:

# A sample with randomly 10 records from original dataset
df_sample10 = df.sample(n=10)

``````

The histogram:

``````

In [47]:

ax = sns.distplot(df_sample10[['temperature']], rug=True, axlabel='Temperature (o F)')

``````
``````

``````

• ???

• ???

### 6. Is there a significant difference between males and females in normal temperature?

What test did you use and why?

• ???

Write a story with your conclusion in the context of the original problem.

• ???

## References:

[1] "What Statistical Analysis Should I Use? Statistical Analyses Using STATA". Last access: 12/25/2017 - Link: https://stats.idre.ucla.edu/stata/whatstat/what-statistical-analysis-should-i-usestatistical-analyses-using-stata/

[2] "T-Score vs. Z-Score: What’s the Difference?". Last access: 12/26/2017 - Link: http://www.statisticshowto.com/when-to-use-a-t-score-vs-z-score/

``````

In [ ]:

``````