mtorchiano / effsize

Effsize - a package for efficient effect size computation
GNU General Public License v2.0
103 stars 11 forks source link

Order of labels change the outcome of VD.A #53

Open GiovaniGuizzo opened 4 years ago

GiovaniGuizzo commented 4 years ago

I ran into this issue the other day. Try to run the following code:

require(effsize)

nsga2<-c(0.59, 0.6, 0.58, 0.59, 0.65, 0.6, 0.59, 0.59, 0.59, 0.6, 0.62, 0.59, 0.61, 0.58, 0.6, 0.61, 0.6, 0.59, 0.59, 0.59, 0.59, 0.6, 0.58, 0.62, 0.56, 0.64, 0.6, 0.62, 0.58, 0.6)
moead<-c(0.47, 0.48, 0.46, 0.48, 0.47, 0.47, 0.44, 0.45, 0.45, 0.47, 0.45, 0.44, 0.46, 0.46, 0.44, 0.41, 0.44, 0.45, 0.45, 0.46, 0.49, 0.44, 0.46, 0.42, 0.5, 0.5, 0.49, 0.48, 0.45, 0.45)

categs <- rep(c("NSGA-II", "MOEA/D"), each=30)
VD.A(c(nsga2,moead), categs)

categs <- rep(c("MOEA/D", "NSGA-II"), each=30)
VD.A(c(nsga2,moead), categs)

The first call of VD.A yields 0 and the second yields 1 by just inverting the labels (wrong answers by the way). Notice that the vectors are not inverted when calling VD.A, only the labels. If one runs VD.A(c(nsga2,moead)) the correct answer 1 is given.

I am not entirely sure, but this does not look like the intended behaviour. I have tested it on Linux and Windows. My version of R is 4.0.1.

Thanks.

mtorchiano commented 4 years ago

Thanks for the report. I will look into it, I fixed a similar bug in another function.