[SciPy-User] Need help to use rv_continuous.fit
Wed Dec 5 10:31:03 CST 2012
On Dec 5, 2012, at 10:11 AM, Sepideh Rastin <firstname.lastname@example.org> wrote:
> Hi there,
> I have histograms that will form the likelihood function and need to
> find the best normal distributions.
> I would like to know if it would be possible to create my input array to
> rv_continuous.fit using the data of my histograms.
If you have the raw data, you can just use mean() and std() functions.
from pylab import *
n = 1000
mu = 2
sigma = 0.3
def G(x,m,s): return exp(-((x-m)/s)**2/2)/sqrt(2*pi*s**2)
# fake data
s = randn(n)*sigma + mu
mu_hat, sigma_hat = mean(s), std(s)
t = linspace(mu-3*sigma,mu+3*sigma,200)
bins = linspace(t,t[-1],21)
step = bins-bins
More information about the SciPy-User