hzambran / hydroGOF

Goodness-of-fit functions for comparison of simulated and observed hydrological time series
https://CRAN.R-project.org/package=hydroGOF
39 stars 13 forks source link

Weighted versions of goodness of fit measures? #11

Closed rogiersbart closed 9 months ago

rogiersbart commented 4 years ago

Hi there,

just a suggestion/question for some enhancement of the package: Did you consider implementing weighted versions of the goodness of fit measures? We use hydroGOF as a backend in RMODFLOW (see rogiersbart/RMODFLOW#18) for model performance evaluation, but in groundwater modelling it is common to work with weights that are for instance based on the measurement error. Any thoughts on this? Would this be a useful extension for hydroGOF? Or do you consider this out of scope?

hzambran commented 4 years ago

I apologise for my very late reply, but these days have been complicated...

Thank for raising this point, which is perfectly within the scope of hydroGOF. BTW, thanks for developing RMODFLOW, which is of high interest for many people !!

The only function that currently has implemented the possibility you describe is NSE, using the argument FUN:

function to be applied to ‘sim’ and ‘obs’ in order to obtain transformed values thereof before computing the Nash-Sutcliffe efficiency.

Is something like:

library(hydroGOF)
obs <- 1:10/10
sim <- 2:11/10
w    <- 0.1*obs/sum(0.1*obs)
myfun <- function(x, w) return(x*w)
NSE(sim=sim, obs=obs, FUN=myfun, w=w)

what you are looking for?

rogiersbart commented 4 years ago

Well, now it's my turn to apologize ...

We are basically looking for inverse-variance weighting, mostly for ME, MAE, MSE and RMSE. The FUN argument of NSE() does indeed seem to provide a solution. Any chance this might be useful to include in the other measures as well? If not, we can always foresee the weighting at our side of course.

hzambran commented 9 months ago

Done in hydroGOF 0.5-0