Professional Documents
Culture Documents
Calculating P-Value
Calculating P-Value
Calculating P-Value
In [2]: #Import libraries, set the seed, and read in the data
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(42)
df = pd.read_csv('coffee_dataset.csv')
Out[6]: 0.26582463905558962
1
Out[8]: <matplotlib.lines.Line2D at 0x7fa355c75d30>
Out[10]: 1.0
New scenario
H0 : µ ≥ 70
H1 : µ < 70
Out[13]: 0.0
New scenario
H0 : µ = 70
H1 : µ ̸= 70
In [14]: null_mean = 70
(null_vals < sample_mean).mean() + (null_vals > null_mean +(null_mean - sample_mean)).m
Out[14]: 0.0
2
In [15]: low = sample_mean
high = null_mean + (null_mean - sample_mean)
plt.hist(null_vals);
plt.axvline(low,color='r', linewidth=2)
plt.axvline(high,color='r', linewidth=2)
In [ ]: