13 Example - Analyzing distribution of sum of two normally distributed random variables#

%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/Z6vANdo1L68/" frameborder="0" allowfullscreen></iframe>
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats

khanacademy

Example - Analyzing distribution of sum of two normally distributed random variables fig 1

df = DataFrame({'mean': [10, 10], 'std. dev.': [1.5, 2]}, index=['To work', 'To home'])
df
mean std. dev.
To work 10 1.5
To home 10 2.0
mean = df['mean'].sum()
var = (df['std. dev.']**2).sum()
std = np.sqrt(var)
mean, var, std
(20, 6.25, 2.5)
x = 25
z_score = (x - mean) / std
z_score
2.0
stats.norm.cdf(z_score)
0.9772498680518208
# find a way to get the ztable and plot the normal dist