Last active
November 15, 2020 22:00
-
-
Save accessnash/855afe31f292cdc83cbe86e48e446a07 to your computer and use it in GitHub Desktop.
Plotting PDF and CDF for a pareto distribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Sun Nov 15 17:45:00 2020 | |
@author: User | |
""" | |
#PDF and CDF of a Pareto distribution | |
from scipy.stats import pareto | |
import matplotlib.pyplot as plt | |
#define distribution parameter | |
alpha = 1.2 | |
#create distribution | |
dist = pareto(alpha) | |
#plot pdf | |
values = [value/10.0 for value in range(10,100)] | |
probs = [dist.pdf(value) for value in values] | |
plt.plot(values, probs) | |
plt.show() | |
#plot cdf | |
cprobs = [dist.cdf(value) for value in values] | |
plt.plot(values, cprobs) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment