I'm trying to draw fitted function(optimized function, best-fit function) for my dataset, by using python. So I ask about a kind of distribution function which can describes my dataset.
According to a hisplot of the data, It dis similar with expon function, but after first sharp declinne, it rises small amount so that it has minor relative maximum and minimum at x in range (30, 80). And it plunged suddenly at x = 80.
How can I find optimized function of this distribution pattern?
Already I used fitter
method from Fitter
Package of Python, however, It couldn't capture detailed form of that distribution.
As suggested by @Reza you can use kernel density estimation by leveraging the gaussia_kde
function. Since no values are provided, I will generate a random distribution. Here is the code:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
data = np.random.randn(1000)
kde = gaussian_kde(data)
x = np.linspace(min(data), max(data), 1000)
fit = kde.evaluate(x)
plt.hist(data, bins=20, density=True)
plt.plot(x, fit)
plt.show()