syntheke / bayesR

Bayesian hierarchical model for complex trait analysis
44 stars 26 forks source link

How include random effects in the model #14

Closed leticia-lara closed 3 years ago

leticia-lara commented 3 years ago

Dear,

I am using this command line to include fixed effects in the model:

bayesR -bfile trainPopData -out simout -covar covariates.txt -numit 100000 -burnin 1000 -thin 10 -permute -snpout

It worked pretty well. However, I also have random effects that I would like to add in the model. Please, is there anyway to do that? Thank you

syntheke commented 3 years ago

All effects are considered "random" in the Bayesian framework. "Fixed" effects are given flat priors (no shrinkage of effects) and estimates are not updated with samples from the posterior distribution (estimates based on information contained in the likelihood only). Informative priors are only implemented for marker effects.

leticia-lara commented 3 years ago

@syntheke Sorry, you did not answer my question. I wanna include a design matrix for year (as factor variable) in order to estimate the specific year effects, and another model matrix for blocks in order to estimate one variance component (which means I wanna add a random effect on the intercept). I managed to include the design matrix for fixed effects (year effect) using the covar argument. How can I include a design matrix for block as random effect? Please, is there anyway to do that? Thank you

gregorgorjanc commented 3 years ago

@syntheke Thanks for responding to @leticia-lara

We would like to add an effect with a normal prior where we estimate variance component - so a "random" effect with an "informative" normal prior - not the flat prior.

Is this possible?

Thanks!

syntheke commented 3 years ago

The software does not support fitting random effects other than marker effects. Have a look at the BGLR R-package which supports fitting additional random effects.

jiefangDuan commented 2 years ago

-numit 100000 -burnin 1000 -thin 10

Dear, Recently I am running BayesR. I have some questions about computation time of bayesR. I'm particularly curious about how long your data took.

About my data, There are 202840 SNPs and 8438 subjects. I include three covariates.

In order to reduce the computation burden, according to the BayesRMannual published in Github (https://github.com/syntheke/bayesR), I used the “500SNPs” strategy by modifying the two options(--msize 500 -mrep 5000). Referring to the manual about time, I infer that my data would take less than six hours. Actually I run the first step about 120 hours, and the first step didn’t finish. I really can't find the reason, so please give me some guidance and suggestions about my code. Thank you very much.

This is the command I used:

train a model

./bayesRv2 -bfile traindata1 -out traindata1 \ -numit 50000 -burnin 20000 -seed 333 \ -blocksize 4 -nthreads 4 \ -msize 500 -mrep 5000 \ -covar cov_train1.txt

prediction

./bayesRv2 -bfile testdata1 -out testdata1 \ -predict -model traindata1.model -freq traindata1.frq \ -param traindata1.param -covar cov_test1.txt \ -alpha traindata1.alpha