zhilizheng / SBayesRC

GNU General Public License v3.0
25 stars 5 forks source link

seed question #36

Closed fazilaliev closed 2 months ago

fazilaliev commented 2 months ago

Hi, Thank you for easy explanations how to run SBayesRC. I'm running SBayesRC and getting different beta estimates in each run with absolutely same analyses. Beta estimates look correlated but are not the same. I tried to set.seed() same in R script just before SBayecRC() line but it didn't help. Maybe, the reason is seed changes before MCMC step in C part. Can you add seed as an option or let me know if it is possible to set seed in the existing code, so that in each of same analyses we get the same results? Thanks, Fazil Aliev, PhD, Rutgers University

fazilaliev commented 2 months ago

Please also note that _tiny.ma and _imp.ma files are absolutely the same. The only difference is in final BETA columns.

head sbrc.txt SNP A1 BETA PIP BETAlast rs12132974 T 3.662889966341e-07 0.000999987125396729 0 rs12134490 C -6.16640844665116e-07 0.000999987125396729 0 rs17276806 T -8.23119429580919e-07 0.00300002098083496 0 head sbrc2.txt SNP A1 BETA PIP BETAlast rs12132974 T -1.17724053277628e-06 0.00300002098083496 0 rs12134490 C 1.16022636926051e-06 0.00349998474121094 0 rs17276806 T -1.70299337562591e-06 0.00599998235702515 0

zhilizheng commented 2 months ago

Hi @fazilaliev ,

It's normal, it's difficult to fix the random generator in multiple thread situation, because we don't know which chain will finish first. The performance of the program will decreased a lot if it's fixed. So, if we'd like a fix results, we have to use one thread, and set the seed by sbayesrc(... seed=SOME_VALUE,).

Regards, Zhili