Im Moment verwenden, ich bin passend empirische Verteilungen gegen theoretische Art, wie erklärt in Fitting empirical distribution to theoretical ones with Scipy (Python)?Fitting empirische Verteilung gegen eine hyperbolische Verteilung scipy.stats
Mit den scipy.stats Verteilungen zeigen die Ergebnisse eine gute Passform für die hyperbolic secant Verteilung.
Hier ist meine aktuelle Ansatz einige scipys Verteilungen mit:
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
# Sample data with random numbers of hypsecant distribution
data = scipy.stats.hypsecant.rvs(size=8760, loc=1.93, scale=7.19)
# Distributions to check
dist_names = ['gausshyper', 'norm', 'gamma', 'hypsecant']
for dist_name in dist_names:
dist = getattr(scipy.stats, dist_name)
# Fit a distribution to the data
param = dist.fit(data)
# Plot the histogram
plt.hist(data, bins=100, normed=True, alpha=0.8, color='g')
# Plot and save the PDF
xmin, xmax = plt.xlim()
x = np.linspace(xmin, xmax, 100)
p = dist.pdf(x, *param[:-2], loc=param[-2], scale=param[-1])
plt.plot(x, p, 'k', linewidth=2)
title = 'Distribution: ' + dist_name
plt.title(title)
plt.savefig('fit_' + dist_name + '.png')
plt.close()
die Plots wie folgt liefert:
Aber ich möchte den Sitz gegen eine testen (verallgemeinerte) hyperbolic distribution auch, da ich die Annahmen habe, dass es eine noch bessere Passform liefern könnte.
Gibt es eine hyperbolische Verteilung in scipy.stats, die ich verwenden kann? Oder gibt es eine Problemumgehung?
Die Verwendung anderer Pakete wäre ebenfalls eine Option.
Vielen Dank im Voraus!
In Verbindung stehende http://stackoverflow.com/questions/28934454/fitting-hyperbolic-and-harmonic-functions-with-curvefit –
Warum der Downvote? Natürlich gibt es einige Beziehungen, aber meine Frage bezieht sich ausdrücklich auf scipy.stats. –
In einem Kommentar hier einige die gleiche Frage gestellt (Umsetzung von hyperbolischen dist. In scipy.stats), aber keine Antwort erhalten: http://StackOverflow.com/Questions/24011209/how-to-normalize-a-histogram- von einer exponentiellen Verteilung in scipy –