Closed gregorgorjanc closed 1 year ago
This should already be the case. The following code should produce the warning below.
library(AlphaSimR)
founderPop = quickHaplo(100, 10, 100)
R = diag(3)
R[1,2] = R[2,1] = 0.9
R[1,3] = R[3,1] = 0.9
SP = SimParam$
new(founderPop)$
addTraitA(100, mean=rep(0,3),
var=rep(1,3), corA=R)$
setVarE(h2=rep(0.3,3))
Warning message: In transMat(corr) : Matrix is not positive semi-definite, see ?transMat for details
Is your feature request related to a problem? Please describe. Based on discussion here https://github.com/gaynorr/AlphaSimR/discussions/97#discussioncomment-4159623 it would be best to warn users when their covariance matrix is not positive definite, so they are warned that simulation outcome can be different to what they expect