thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
248 stars 150 forks source link

likelihoods.py, generalizedLikelihoodFunction residuals not computed correctly #257

Closed jds485 closed 3 years ago

jds485 commented 3 years ago

The residuals should be with respect to the scaled (bias-corrected) value (E in Schoups and Vrugt, 2010, Eq. 1). They are currently computed with respect to the unscaled value (Y_h in Schoups and Vrugt, 2010, Eq. 2) using the __calcSimpleDeviation function.

A new function is needed, similar to the following: def calcSimpleDeviation_bias(data, comparedata, mu_h): standartChecksBeforeStart(data, comparedata) d = np.array(data) c = np.array(comparedata)

Adjust c for multiplicative bias parameter:

mu_t = np.exp(mu_h * c)
Et = c * mu_t
return d - Et

The function is called in Line 432.

thouska commented 3 years ago

Hi @jds485 thank you for your bugreport and the provided solution! I included your suggested fix. This will be available in spotpy version >=1.5.14