YinLiLin / hibayes

:swimmer: Individual-Level, Summary-Level and Single-Step Bayesian Regression Models for Genomic Prediction and Genome-Wide Association Studies
GNU General Public License v3.0
46 stars 7 forks source link

Posterior distribution of gebvs (or other parameters) #13

Open jslate1 opened 2 years ago

jslate1 commented 2 years ago

Is it possible to output the MCMC estimates of gebvs every, e.g. 100th sample, of the MCMC chain? Sometimes it is useful to see the posterior distribution of each individual's gebv. I realise this would result in large files, and perhaps not everybody needs them, but it would be nice to have the option. Perhaps I missed it somewhere. This looks like a really nice package anyway - thank you!

YinLiLin commented 2 years ago

Thank you. Very nice suggestion. We will add this function in the next version, and once finished, i will leave you a message here.

jslate1 commented 2 years ago

That sounds great - thank you 👍

YinLiLin commented 2 years ago

Hi, the latest version (1.1.0) on GitHub has been updated with the function of returning the MCMC estimates of all model parameters, it can be easily obtained from the list $MCMCsamples, taking individual-level Bayesian model for an example, the returned results are as follows:

> str(fit)
List of 10
 $ Vg         : num 3.91
 $ Ve         : num 24.9
 $ h2         : num 0.136
 $ mu         : num 0.405
 $ alpha      : num [1:7385, 1] 0.00 -3.17e-04 2.56e-04 -2.36e-05 0.00 ...
 $ pi         : num [1:2, 1] 0.99762 0.00238
 $ g          : num [1:4798] -2.98 -5.45 1.52 -2.34 -3.26 ...
 $ e          : num [1:4798] 0.527 -2.744 1.479 -8.43 3.317 ...
 $ pip        : num [1:7385, 1] 0.000125 0.0005 0.000625 0.0005 0.000375 ...
 $ MCMCsamples:List of 7
  ..$ Vg   : num [1, 1:400] 3.68 3.83 3.88 3.9 3.93 ...
  ..$ Ve   : num [1, 1:400] 25.3 24.6 24.5 24.3 25.4 ...
  ..$ h2   : num [1, 1:400] 0.127 0.135 0.137 0.138 0.134 ...
  ..$ mu   : num [1, 1:400] 0.4576 0.4069 0.4688 -0.0538 -0.0587 ...
  ..$ alpha: num [1:7385, 1:400] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ pi   : num [1:2, 1:400] 0.99648 0.00352 0.99881 0.00119 0.99812 ...
  ..$ g    : num [1:4798, 1:400] -2.02 -6.15 1.51 -2.42 -2.28 ...

Please feel free to have a try. Thanks.

jslate1 commented 2 years ago

That sounds great - thank you. I will give it a try.

Best regards Jon

Professor Jon Slate (he/him/his)
School of Biosciences
University of Sheffield
http://jon-slate.staff.shef.ac.uk
twitter: @jon_slate
Editor-in-Chief: Evolution Letters <http://www.evolutionletters.com>

I don't expect you to respond to my email outside your working hours. At the University of Sheffield we value and encourage flexible working. Please be assured that I respect your working patterns and look forward to your response when you are next at work.

On Wed, 6 Apr 2022 at 11:35, Lilin Yin @.***> wrote:

Hi, the latest version (1.1.0) on GitHub has been updated with the function of returning the MCMC estimates of all model parameters, it can be easily obtained from the list $MCMCsamples, taking individual-level Bayesian model for an example, the returned results are as follows:

str(fit)List of 10 $ Vg : num 3.91 $ Ve : num 24.9 $ h2 : num 0.136 $ mu : num 0.405 $ alpha : num [1:7385, 1] 0.00 -3.17e-04 2.56e-04 -2.36e-05 0.00 ... $ pi : num [1:2, 1] 0.99762 0.00238 $ g : num [1:4798] -2.98 -5.45 1.52 -2.34 -3.26 ... $ e : num [1:4798] 0.527 -2.744 1.479 -8.43 3.317 ... $ pip : num [1:7385, 1] 0.000125 0.0005 0.000625 0.0005 0.000375 ... $ MCMCsamples:List of 7 ..$ Vg : num [1, 1:400] 3.68 3.83 3.88 3.9 3.93 ... ..$ Ve : num [1, 1:400] 25.3 24.6 24.5 24.3 25.4 ... ..$ h2 : num [1, 1:400] 0.127 0.135 0.137 0.138 0.134 ... ..$ mu : num [1, 1:400] 0.4576 0.4069 0.4688 -0.0538 -0.0587 ... ..$ alpha: num [1:7385, 1:400] 0 0 0 0 0 0 0 0 0 0 ... ..$ pi : num [1:2, 1:400] 0.99648 0.00352 0.99881 0.00119 0.99812 ... ..$ g : num [1:4798, 1:400] -2.02 -6.15 1.51 -2.42 -2.28 ...

Please feel free to have a try. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/YinLiLin/hibayes/issues/13#issuecomment-1090115340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3QRC7EMBHOQKSNAZBIOM3VDVSH7ANCNFSM5PCVWK7A . You are receiving this because you authored the thread.Message ID: @.***>