bluefoxr / COINr

COINr
https://bluefoxr.github.io/COINr/
Other
25 stars 8 forks source link

Aggregation error with gmean #47

Closed MoujibChahid closed 1 year ago

MoujibChahid commented 1 year ago

Aggregation using the geometric mean method (gmean) is not possible.

An error message appears telling me that two indicators contain zero or negative values, when this is not the case. COINr prompts me to normalize the data in order to be able to aggregate the indicators using the gmean method, even though they are already normalized.

This is the error message displayed:

coin <- Aggregate(coin, dset = "Normalised", f_ag = "a_gmean") Error in a_gmean(x = c(SI.IDH.03 = 84.1893454977897, SI.REV.03 = 56.5969718817592, : Negative or zero values found when applying geometric mean. This doesn't work because geometric mean uses log. Normalise to remove negative/zero values first or use another aggregation method.

Voici la preuve que les données sont déjà normalisées :

coin <- qNormalise(coin, dset = "Raw", f_n = "n_minmax",

  • f_n_para = list(l_u = c(0, 100))) Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised Written data set to .$Data$Normalised

I absolutely need to use the gmean method for sensitivity analysis purposes, so please remedy the situation.

I would like to thank you in advance for your usual assistance in enabling me to benefit from this magnificent tool.

bluefoxr commented 1 year ago

If you use the geometric mean you need to make sure the normalised values don't contain zeroes or negative values. Which means choose a normalisation method that doesn't do that.

The one you have: f_n_para = list(l_u = c(0, 100))) clearly creates normalised data which contains zeroes, which is the problem. Try something like f_n_para = list(l_u = c(1, 100))).

MoujibChahid commented 1 year ago

It's perfect. Thank you for your usual responsiveness and cooperation.

The resulting error message may need to be reworded to be more informative, especially for the indicators displayed and their values.