I have some data that is normally distributed and to which I have fitted a pdf. However, I want to get the probability of the likelihood of a given value from the dataset occurring. From my understanding, this is the area of the bin under the pdf for where the value of x lies. Is there a numpy or scipy.stats function to generate this? I have looked but either Im not seeing it or my lack of understanding is holding me back. So far I have:
import h5py
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.mlab as mlab
import scipy.stats as stats
import numpy
import math
a = 'data.h5'
f = h5py.File(a,'r')
dset = f['/DATA/DATA/']
values = dset[...,0]
I can then generate a histogram of this data and fit a pdf to it:
n, bins, patches = plt.hist(values, 50, normed=1)
mu = np.mean(values)
sigma = np.std(values)
plt.plot(bins, mlab.normpdf(bins, mu, sigma))
plt.show()
And I can retrieve the f(x) for a given value of x (in this case 0.65)
print(stats.norm.pdf(0.65, np.mean(mb1), np.std(mb1)))
Can someone help me generate my probability from this?
I have attached the outputted histogram with pdf.