cuelee / pleio

17 stars 6 forks source link

An error occurs when running pleio for multiple traits #23

Open SuzyCC719 opened 1 year ago

SuzyCC719 commented 1 year ago

Hi Cue Lee, I have successfully run pleio for 2 traits but got stuck when running pleio for 6 traits. The error is “numpy.linalg.LinAlgError: singular matrix”. Could you please help me with this issue? The log file is listed below.


Beginning analysis at Tue May 23 17:33:56 2023 Genetic covariance matrix is not a positive definite matrix Environmental correlation matrix is not a positive definite matrix Generating 100000 stats (this calculation is expected to take a long time). Analysis finished at Tue May 23 17:34:22 2023 Total time elapsed: Traceback (most recent call last): File "/public/home/pleio-master/pleio.py", line 218, in pleio(args,log) File "/public/home/pleio-master/pleio.py", line 135, in pleio data.isf_zero_prob = importance_sampling(data.isf_Nsim, data.N_sample, data.gencov, data.envcor, data.isf_output, data.ncpu); File "/public/home/pleio-master/framework/importance_sampling.py", line 206, in importance_sampling d_Q = MVN.pdf( input_df, [0] * n, Ce ); File "/public/home/anaconda3/envs/pleio/lib/python3.7/site-packages/scipy/stats/_multivariate.py", line 516, in pdf psd = _PSD(cov, allow_singular=allow_singular) File "/public/home/anaconda3/envs/pleio/lib/python3.7/site-packages/scipy/stats/_multivariate.py", line 165, in init raise np.linalg.LinAlgError('singular matrix') numpy.linalg.LinAlgError: singular matrix.

Looking forward to hearing from you.

Many thanks and best wishes,

Suzy

cuelee commented 1 year ago

Hi Suzy,

Regarding the error you encountered while running pleio for 6 traits, it would be helpful to check both inputs for "sg" (genetic covariance matrix) and "ce" (environmental correlation matrix) files. Make sure they are correctly formatted and contain valid data. Additionally, it would be beneficial to test if these matrices are singular.

PLEIO has the capability to test and fix mild negative Eigen values, but it may raise an error when it encounters severe singularity. Therefore, it's important to ensure that the matrices you provide as input are not singular.

Please verify the input files and test the matrices for singularity. If you find any issues or if the matrices are singular, you may need to revise them accordingly. If you require further assistance, don't hesitate to reach out to me for additional support.