Ich versuche, ein Skript zu erstellen, um die Kumaraswamy-Laplace-Verteilung anzupassen. Anpassung wird immer mit Nan -Fehler irgendwo. < /p>
mit dem folgenden Versuch: < /p>
import numpy as np
import pandas as pd
import scipy.stats as st
from scipy.special import beta
class kl(st.rv_continuous):
def _pdf(self, x, mu, sigma, p, q):
v = ( x - mu ) / sigma
#I tried two ways of defining of the function
#y = .5 + .5 * np.sign( v ) * ( 1 - np.exp( - np.abs( v ) ) )
#fx = p * q *.5 / sigma * np.exp( - np.abs( v ) ) * y ** ( p - 1 ) * ( 1 - y ** p ) ** ( q - 1 )
fx = np.where( v < 0 ,
p * q * 2. **(-p) * np.exp( p * v ) * (1. - 2. ** ( - p ) * np.exp( p * v)) **(q - 1.),
.5 * p * q * np.exp (-v) * (1.-.5*np.exp(-v))**(p-1.) * (1.-(1.-.5*np.exp(-v))**p)**(q-1.)
)
return fx
def _argcheck(self, mu, sigma, p, q):
s = sigma > 0
p_bool = p > 0
q_bool = q > 0
all_bool = s & p_bool & q_bool
return all_bool
< /code>
Es scheint, dass ich immer mit dem Fehler ValueError enden: Der Funktionswert bei x = nan ist nan; Solver kann nicht fortgesetzt werden.
Beim Versuch, die Verteilung anzupassen. Ich nehme an, es stammt aus einem Überlauf, aber ich bin nicht sicher, und ich weiß nicht, wie man es löst! />
Ich versuche, ein Skript zu erstellen, um die Kumaraswamy-Laplace-Verteilung anzupassen. Anpassung wird immer mit Nan -Fehler irgendwo. < /p> mit dem folgenden Versuch: < /p> [code]import numpy as np import pandas as pd import scipy.stats as st from scipy.special import beta
class kl(st.rv_continuous):
def _pdf(self, x, mu, sigma, p, q):
v = ( x - mu ) / sigma #I tried two ways of defining of the function #y = .5 + .5 * np.sign( v ) * ( 1 - np.exp( - np.abs( v ) ) ) #fx = p * q *.5 / sigma * np.exp( - np.abs( v ) ) * y ** ( p - 1 ) * ( 1 - y ** p ) ** ( q - 1 ) fx = np.where( v < 0 , p * q * 2. **(-p) * np.exp( p * v ) * (1. - 2. ** ( - p ) * np.exp( p * v)) **(q - 1.), .5 * p * q * np.exp (-v) * (1.-.5*np.exp(-v))**(p-1.) * (1.-(1.-.5*np.exp(-v))**p)**(q-1.) )
return fx
def _argcheck(self, mu, sigma, p, q):
s = sigma > 0 p_bool = p > 0 q_bool = q > 0
all_bool = s & p_bool & q_bool
return all_bool < /code> Es scheint, dass ich immer mit dem Fehler ValueError enden: Der Funktionswert bei x = nan ist nan; Solver kann nicht fortgesetzt werden. [/code] Beim Versuch, die Verteilung anzupassen. Ich nehme an, es stammt aus einem Überlauf, aber ich bin nicht sicher, und ich weiß nicht, wie man es löst! />[code]initial_guess = [np.mean(sample_data), np.std(sample_data), 1.0, 1.0] # [mu, sigma, p, q] estimated_params = my_sgt_distribution.fit(sample_data, *initial_guess) < /code> und zu Diagramm: < /p> import matplotlib.pyplot as plt import numpy as np
# Explicitly given parameters (replace with your desired values) mu = 0 sigma = 1 p = 0.6 q = 0.7
# Create an instance of custom distribution my_kl_distribution = kl()
# Generate x values for plotting x_values = np.linspace(-5, 5, 1000)
# Calculate PDF and CDF values pdf_values = my_kl_distribution.pdf(x_values, mu, sigma, p, q) cdf_values = my_kl_distribution.cdf(x_values, mu, sigma, p, q)
# Plot the PDF plt.figure(figsize=(10, 5)) plt.plot(x_values, pdf_values, label='PDF') plt.title('Probability Density Function (PDF) of Kumaraswamy Laplace Distribution') plt.xlabel('x') plt.ylabel('Density') plt.legend() plt.grid(True) plt.show()
# Plot the CDF plt.figure(figsize=(10, 5)) plt.plot(x_values, cdf_values, label='CDF', color='orange') plt.title('Cumulative Distribution Function (CDF) of Kumaraswamy Laplace Distribution') plt.xlabel('x') plt.ylabel('Probability') plt.legend() plt.grid(True) plt.show() [/code]
Ich habe diese Flutter -App, die über die Verteilung von Firebase App verteilt wird. Wir haben in letzter Zeit einige Funktionen vorangetrieben, aber als wir versucht haben, die neueste Version aus...
Ich versuche, eine GPD in Python zu passen. Standard -Genpareto.fit von scipy funktioniert, aber ich möchte Parameterfehler (Empfindlichkeit) und leider nicht bereitgestellt. Wenn ich versuche, die...
Ich möchte die Intervallschätzung der Bevölkerungsstandardabweichung berechnen. Dafür brauche ich die kritischen Chi-Quadrat-Werte für die untere und obere Grenze. Die zu berechnende Formel ist dies...
Ich versuche, Quantile für einige Schneedaten unter Verwendung der Log Pearson Typ 3 -Verteilung in Python abzuschätzen und mit R zu vergleichen. Ich mache dies, indem ich in den Daten liest, log...