You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to find the best Bivariate fit for my data and produce new samples. When I choose the Clayton model, I receive decent data. However, when I choose Frank or Gumbel, the produced data turns out like the below figure. I was wondering if someone could help me with that.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from copulas.bivariate.base import Bivariate, CopulaTypes
from copulas.bivariate.clayton import Clayton
from copulas.bivariate.frank import Frank
from copulas.bivariate.gumbel import Gumbel
import scipy.stats as stats
""" Preparing data """
with open('Maximum Yearly Discharge.txt', 'r') as f:
file = f.read()
lst = file.split('\n')
x = np.array([])
for i in lst:
x = np.append(x, float(i))
with open('Prediction.txt', 'r') as f:
file = f.read()
lst = file.split('\n')
y = np.array([])
for i in lst:
y = np.append(y, float(i))
z = np.append(x, y)
z = np.reshape(z, (int(len(z)/2), 2), order='F')
copula = Bivariate(CopulaTypes.FRANK)
copula.fit(z)
""" Producing Samples"""
samples = copula.sample(1000)
normalized_x = (x-min(x))/(max(x)-min(x))
normalized_y = (y-min(y))/(max(y)-min(y))
plt.scatter(samples[:, 0], samples[:, 1], color='0.75', label='Simulated Data')
plt.scatter(normalized_x, normalized_y, label='Empirical Data', color='blue')
plt.xlabel('Maximum Yearly Discharge (Scaled)')
plt.ylabel('Associated Tidal height (Scaled)')
plt.legend(loc='lower right')
plt.savefig('Simulated Data.jpg')
plt.show()
Hi @Kafkaica Upon reviewing it, we detected a bug in the way the samples were produced inside the Frank and Gumbel classes.
We just fixed it and a new release with this bug fix will be created soon.
Hi
I am trying to find the best Bivariate fit for my data and produce new samples. When I choose the Clayton model, I receive decent data. However, when I choose Frank or Gumbel, the produced data turns out like the below figure. I was wondering if someone could help me with that.
Maximum Yearly Discharge.txt
Prediction.txt
The text was updated successfully, but these errors were encountered: