gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
43 stars 18 forks source link

warning message when correlation matrix is not positive semi-definite #44

Closed Prof-ThiagoOliveira closed 2 years ago

Prof-ThiagoOliveira commented 2 years ago

I suggest you add a warning message when correlation matrices are not positive semi-definite (as explained in the opened issue - https://github.com/gaynorr/AlphaSimR/issues/43#issue-1146083980).

gaynorr commented 2 years ago

Thanks for working on this. I think I'm going to go in a different way however. I think I'm going to implement this check in the rotMat function along with the test for symmetry. I'll also document this function so that I can point the user to an explanation for the warning.

I suspect that three cases to be the most common for triggering this warning. The first is just a mistake in the input. The second would be intended when the user is setting a correlation to 1. The last would be the trickiest for a user where what they are seeing is likely the bi-product of the estimation process. For this case, I was thinking of suggesting the user investigate matrix bending. Perhaps by citing this paper. Any thoughts?

Prof-ThiagoOliveira commented 2 years ago

great! =D