Skip to content

Instantly share code, notes, and snippets.

@lucdangelis
Last active May 24, 2019 23:09
Show Gist options
  • Save lucdangelis/36da0e8a4ae41ec8b19cfe26baab1689 to your computer and use it in GitHub Desktop.
Save lucdangelis/36da0e8a4ae41ec8b19cfe26baab1689 to your computer and use it in GitHub Desktop.
p = 0.52
p_arr = []
for i in range(0,10):
proba_inactive = p*(1-p)**(i-1)
p_arr.append(proba_inactive)
p_arr = np.array(p_arr)
p_arr /= p_arr.sum()
plt.plot(range(1, 10), p_arr, color='black', linewidth=0.7, zorder=1)
plt.ylabel('Probability inactive')
plt.xlabel('Number of Transactions')
plt.xticks(range(0, 10))
plt.title('(Shifted) Geometric Probability Mass Function')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment