CDF v eCDF
Hello everyone, I am trying to calculate the CDF and eCDF of the value V in my problem. The code snippet I am using for the graph is as follows :
V_values = new1['V'].dropna()
mu, std = norm.fit(V_values)
x_theor = np.linspace(0, 1, 1000) theoretical_cdf = norm.cdf(x_theor, mu, std)
V_sorted = np.sort(V_values) ecdf = np.arange(1, len(V_sorted) + 1) / len(V_sorted)
plt.figure(figsize=(10, 6)) plt.plot(x_theor, theoretical_cdf, linestyle='-', label='CDF (Normal)') plt.step(V_sorted, ecdf, where='post', linestyle='-', label='Empirical CDF', color = 'red')
It is strange that the CDF does not reach 1, but the eCDF does. How can I solve this?
Thanks
The CDF does not reach 1, and I tried that snippet on other pieces of my code (not related to V, but the idea of calculating CDF) and it never had this kind of problem, so it is weird.
Andi Menga is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.