File:Generalized normal cdfs 2.svg
Summary
| Description |
English: Plots of cumulative distribution functions (CDFs) for several members of the generalized normal family of probability distributions. Note that this is one of (at least two) distributions known as the "generalized normal distribution." |
| Date | |
| Source | Own work |
| Author | Skbkekas |
| SVG development | |
| Source code | Python code## Generate plots of the cumulative distribution functions (CDFs) for several
## members of the generalized normal family of probability distributions.
##
## Note that there are (at least) two families of distributions refered to
## as "generalized normal."
##
## Requires numpy, matplotlib, and scipy.special.
import matplotlib.pyplot as plt
import numpy as np
import scipy.special as sp
def dens(X, k):
if k!=0: Y = -np.log(1-k*X)/k
else: Y = X
Y = np.exp(-Y**2/2)/np.sqrt(2*np.pi)
return Y/(1-k*X)
def cdf(X, k):
if k!=0: Y = -np.log(1-k*X)/k
else: Y = X
return sp.ndtr(Y)
w = 1.5
plt.clf()
colors = ['aqua', 'lime', 'deeppink', 'darkorange', 'blue']
K = [-1, -0.5, 0, 0.5, 1]
m = 8
F = []
for c,k in zip(colors, K):
if k==0: a,b=-m,m
elif k>0: a,b = -m,min(m, 1/float(k))
else: a,b = max(-m,1/float(k))+1e-8,m
X = np.arange(a, b, 0.01)
Y = dens(X, k)
f = plt.plot(X, Y, '-', color=c, lw=w)
F.append(f)
plt.hold(True)
s = ["$\\kappa=%s$" % k for k in K]
b = plt.legend(tuple(F), tuple(s), 'upper left')
plt.ylabel("Density")
b.draw_frame(False)
plt.xlim(-4, 4)
plt.savefig("generalized_normal_densities_2.svg")
plt.savefig("generalized_normal_densities_2.png")
plt.clf()
F = []
for c,k in zip(colors, K):
if k==0: a,b=-m,m
elif k>0: a,b = -m,min(m, 1/float(k))
else: a,b = max(-m,1/float(k))+1e-8,m
X = np.arange(a, b, 0.01)
Y = cdf(X, k)
f = plt.plot(X, Y, '-', color=c, lw=w)
F.append(f)
plt.hold(True)
b = plt.legend(tuple(F), tuple(s), 'upper left')
plt.ylabel("Cumulative probability")
b.draw_frame(False)
plt.ylim(0,1)
plt.xlim(-4,4)
plt.savefig("generalized_normal_cdfs_2.svg")
plt.savefig("generalized_normal_cdfs_2.png")
|
Licensing
I, the copyright holder of this work, hereby publish it under the following licenses:
| Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. |
| This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. | ||
| ||
| This licensing tag was added to this file as part of the GFDL licensing update. |
Copyleft: This work of art is free; you can redistribute it and/or modify it according to terms of the Free Art License. You will find a specimen of this license on the Copyleft Attitude site as well as on other sites. |
You may select the license of your choice.