- #1
ORF
- 170
- 18
- TL;DR Summary
- Is there any built-in function to perform Binned Maximum Likelihood fit in python standard libraries?
Hi,
I have been using Python for a while now, but so far for Least-squares fits using curve_fit from Scipy.
I would like to start using Likelihood method to fit binned and unbinned data. I found some documentation in Scipy of how to implement unbinned likelihood fit, but I have not managed to make it work for a simple exponential...
I found that Pandas has some fit capabilities, but still quite limiting.
Question: is there any functionality in python equivalent to curve_fit from Scipy for Binned/Unbinned likelihood fits?
Thank you for your time.
Cheers,
ORF
I have been using Python for a while now, but so far for Least-squares fits using curve_fit from Scipy.
I would like to start using Likelihood method to fit binned and unbinned data. I found some documentation in Scipy of how to implement unbinned likelihood fit, but I have not managed to make it work for a simple exponential...
Unbinned likelihood fit:
from scipy.stats import rv_continuous
import numpy as np
class myfunc_gen(rv_continuous):
"Exp distribution"
def _pdf(self, x,a):
return np.exp(x*a)
myfunc = myfunc_gen(name='exp')
a = 1.
x = myfunc.rvs(a, size=10)
a1, loc1, scale1 = myfunc.fit(x, a, floc=0, fscale=1)
I found that Pandas has some fit capabilities, but still quite limiting.
Question: is there any functionality in python equivalent to curve_fit from Scipy for Binned/Unbinned likelihood fits?
Thank you for your time.
Cheers,
ORF