TiagoOlivoto/metan

MGIDI selection differential is false if averaged data is negative

Closed this issue · 2 comments

Hi,

First, thanks a lot for the package and especially for MGIDI algorithm.
I applied mgidi function both on blup data, with trait values being centered on 0 for the whole population. Hence, I have negative values for the traits. When I output the sel_dif table, I find for some traits negative values in the column SDperc, despite a positive selection differential.
As an example, this is my sel_dif table:
image

Every time Xo (average value of the trait for the whole population) is negative, the resulting SDperc has the wrong sign.

The explanation is in the code of the MGIDI function L.302.
I think it would be more correct to use the absolute value for Xo in the denominator.

Thanks again,

Charlotte

Hi @chabrault,
Thanks for pointing this out.
I just committed a fix including the abs() in the denominator formula (which is the correct one).
Please, let me know if this works now.

It works fine, thanks a lot!