Open dorcasgicuku opened 2 years ago
Hello, I am having a similar error to this - @dorcasgicuku did you come to a solution? Details of my problem are below:
Copulas version: 0.9.0 Python version: 3.8.8 (iPython environment in Spyder) Operating System: Windows
Fitting Bivariate Gumbel copula returns ValueError
from copulas.bivariate import Bivariate
# Format data
copula_arr=np.array([x,y]).T
# Initialise the copula
copula=Bivariate(copula_type='gumbel')
# Fit the copula to the extremes
copula.fit(copula_arr)
Please note that x and y are on uniform margins as required. Please see histograms of x and y below.
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Temp\ipykernel_15604\3537192975.py", line 1, in <module>
run_solar_earth_bi_eva.phi_d_vs_ae()
File "C:\Users\admin\Documents\wind_waves_akr_code\run_solar_earth_bi_eva\run_solar_earth_bi_eva.py", line 680, in phi_d_vs_ae
bs_copula_arr.append(fit_copula_to_extremes.fit_copula_bivariate(bs_phid_um, bs_ae_um, 'phi_d', 'AE'))
File "C:\Users\admin\Documents\wind_waves_akr_code\bi_multi_variate_eva\fit_copula_to_extremes.py", line 61, in fit_copula_bivariate
copula.fit(copula_arr)
File "C:\Users\admin\anaconda3\lib\site-packages\copulas\bivariate\base.py", line 186, in fit
self._compute_theta()
File "C:\Users\admin\anaconda3\lib\site-packages\copulas\bivariate\base.py", line 167, in _compute_theta
self.check_theta()
File "C:\Users\admin\anaconda3\lib\site-packages\copulas\bivariate\base.py", line 130, in check_theta
raise ValueError(message.format(self.theta, self.copula_type.name))
ValueError: The computed theta value 0.9601028214324197 is out of limits for the given GUMBEL copula.
Experimenting, the Gumbel copula has a theta range of 1-inf:
from copulas.bivariate import Bivariate
copula=Bivariate(copula_type='gumbel')
print(copula.theta_interval)
out: [1, inf]
Given that I'm inputing data on uniform margins, why is the copula fitting the data in a way that's out of bounds? Please note that I have also used this same copula from this package without errors.
Thanks, Alexandra
Just to note I came to a solution on this. Essentially the data I was putting in to copula.fit
was not related as it should be. Essentially x
and y
were almost independent, and hence the fitting was not a success.
Hence I'm not sure if this is a bug. If that's the case, it could be helpful to make the error message more verbose if possible! Thanks, Alexandra
Working with Gumbel and Clayton Copula with weather dataset produces the following error for some set of variables.
Clayton Error ValueError Traceback (most recent call last)