Skip to content

Instantly share code, notes, and snippets.

@accessnash
Last active November 15, 2020 22:00
Show Gist options
  • Save accessnash/855afe31f292cdc83cbe86e48e446a07 to your computer and use it in GitHub Desktop.
Save accessnash/855afe31f292cdc83cbe86e48e446a07 to your computer and use it in GitHub Desktop.
Plotting PDF and CDF for a pareto distribution
# -*- 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