josefin-werme / LAVA

51 stars 9 forks source link

Error in if (any(out.of.bounds)) : missing value where TRUE/FALSE needed #35

Closed bobbykoeleman closed 2 years ago

bobbykoeleman commented 2 years ago

Hi, I am very interested in one particular locus for which I want to run a partial correlation. However, I get this out of bound error. I tried also with a higher param.lim, but no effect. Do you have an idea if this can be solved? Thanks, Bobby

run.pcor(locus, target=c("FE","GGE"), phenos='FS', adap.thresh=NULL) [1] "~ Running partial correlation for 'FE' and 'GGE', conditioned on 'FS'" Error in if (any(out.of.bounds)) { : missing value where TRUE/FALSE needed In addition: Warning message: In sqrt(partial.var(omega, x, z) * partial.var(omega, y, z)) : NaNs produced

cadeleeuw commented 2 years ago

Hi,

This is a known bug that occurs when the partial variances are estimated to be negative. It has already been fixed in the development branch of LAVA, but not yet the main distribution.

What this suggests though, is that in this locus, the rG between FS and either FE or GGE (or both) is equal to 1 or -1, ie. FS explains all the variance in either FE or GGE. Since a partial correlation is the correlation of the residuals that remain after accoounting for the conditioned-on variables, here FS, that means that in this case the partial correlation between FE and GGE given FS isn't defined / doesn't exist.

As such, though the error shown is a bug in the code, the underlying cause isn't something that can be solved. Do let us know if neither of the correlations of FS with FE or GGE is 1 or -1 though, in that case something else might additionally be going wrong, but I would expect that to be the case here.

Christiaan

bobbykoeleman commented 2 years ago

Hi Christiaan,

Thank you for the quick response and clear explanation!

Indeed the rG between FE and FS is equal to 1! So that make sense, no need to run this...

Best wishes, Bobby