コード例 #1
0
variance = 1
sigma = math.sqrt(variance)
x = np.linspace(mu - 4 * sigma, mu + 4 * sigma, 1000)

title_font = {
    'fontname': 'Arial',
    'size': '14',
    'color': 'black',
    'weight': 'normal',
    'verticalalignment': 'bottom'
}

plt.figure(1)

plt.subplot(231)
md = extras.pdf_mvsk([mu, sigma, 1, 0])

plt.plot(x, md(x), color='k')
plt.title('SKEW > 2', **title_font)
plt.ylim(0, 0.5)
plt.xlim(-4, 4)
plt.xticks([])
plt.yticks([])
plt.show()

plt.subplot(232)
plt.title('-2 < SKEW < 2', **title_font)
md = extras.pdf_mvsk([mu, sigma, 0, 0])
plt.plot(x, md(x), color='k')
plt.ylim(0, 0.5)
plt.xlim(-4, 4)
コード例 #2
0
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 20 15:12:54 2018

@author: 79127
"""
import numpy as np
import statsmodels.sandbox.distributions.extras as extras
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('seaborn')




GC = extras.pdf_mvsk([1, 2, 4, 2])
GC(0.05)
GC?


from scipy.stats import norm
norm.pdf(0.5)


norm.ppf?


x = np.linspace(norm.ppf(0.01),norm.ppf(0.99), 100)
plt.plot(x, norm.pdf(x),'r-', lw=5, alpha=0.6, label='norm pdf')

コード例 #3
0
ファイル: sorting.py プロジェクト: tobiasi/TextPremium
# delete ax2 from the figure
plt.delaxes(ax2)

# add ax2 to the figure again
plt.subplot(ax2)





v=j-a

n=np.linspace(-3,3,10000)
sorting = []
indexob = []
pdf_sort = gh.pdf_mvsk( [res7.mean()[0],res7.std()[0]**2,res7.skew()[0],res7.kurt()[0]-3])
pdf_indx = gh.pdf_mvsk( [resind.mean()[0],resind.std()[0]**2,resind.skew()[0],resind.kurt()[0]-3])
for ii in n:
    sorting.append(pdf_sort(ii))
    indexob.append(pdf_indx(ii))
    
a=res1.std()
b=res2.std()
c=res3.std()
d=res4.std()
e=res5.std()
f=res6.std()
g=res7.std()
h=res8.std()
i=res9.std()
j=res10.std()
コード例 #4
0
from statsmodels.sandbox.distributions.extras import pdf_mvsk
import numpy as np
from parameters_range_Probmap import mu_range, sigma_range, skew_range, kurt_range
from pylab import plot, show

dist_space = np.arange((int(mu_range) - int(round(2) * round(sigma_range, 2))),
                       (int(mu_range) + int(round(2) * round(sigma_range, 2))))
diam_phi = ', '.join(map(str, dist_space))

diam_phi = str("[") + str(diam_phi) + str("]")

npar = str(len(dist_space))

a = (mu_range, sigma_range, skew_range, kurt_range)

mf = pdf_mvsk(a)
probs = np.round(abs(mf(dist_space)), 8)
probs2_1 = np.round(probs / sum(probs), 8)
probs2 = ', '.join(map(str, probs2_1))

probs2 = str("[") + str(probs2) + str("]")

#plot(dist_space, probs2_1)
#show()
with open("sample_TGSD.txt", "w") as f1:
    f1.write(npar), f1.write('\n')
    f1.write(probs2), f1.write('\n')
    f1.write(diam_phi)
    f1.close()

print "Grain Sizes = ", npar
コード例 #5
0
        STD = np.std(x)
        SKEW = stats.skew(x)
        KURT = stats.kurtosis(x)
    )
    return out

# creating distribution
for i in range(15):
    d = connorav.MSSKDistribution(mu, std, skew, kurt)
    x_rand = d.rvs(N)
    print(stats.kurtosis(x_rand))

    # instancing distrution
    # N = 10000

# ============================================================
# Statsmodels

from statsmodels.sandbox.distributions.extras import pdf_mvsk
import numpy as np
from matplotlib import pyplot as plt

pdf = pdf_mvsk([mu, std, skew, kurt])
x = np.linspace(pdf(1e-4), pdf(1-1e-4))
y = np.array([pdf(xi) for xi in x])

plt.plot(x,y)
plt.show()


コード例 #6
0
ファイル: hist.py プロジェクト: djsissom/dissertation
	def func(x, A):
		pdf_function = extrastats.pdf_mvsk([mu, sigma, skew, kurtosis])
		return A * pdf_function(x)