0

I'm doing a research study about bayesian modelling in R. I'm using the brm function of brms package. Below is a part of my code where I obtain my model (chains=4, iter=2000). However I have a doubt about the functionalities of the brm function. I would like to ask if it is possible to obtain and see the intermediate models of my final model, and if so, how can I obtain them.

Thanks.

Example of code is as follow:
here it goes some sample data of tes1:

structure(list(x1 = c(3.44927113307877, 3.54074826669382, 3.99348696707238, 
4.19239423225477, 3.90247396410756, 3.9925317332974, 3.79666139804662, 
3.73440713024736, 3.61039528528753, 3.07083360780303, 3.33320841288193
), x2 = c(3.8269252, -3.413802, -4.4209441, -2.3161268, -0.1620005, 
0.9786031, 0.903769, 0.2605405, 2.7162893, -0.9301981, -3.8124367
), x3 = c(3.09366356660139, 3.14150311886572, 3.04341989824532, 
3.01471601810818, 3.04393885842653, 3.09195021303798, 3.18649210897263, 
3.14328027186067, 3.15065098693938, 3.23121235637973, 3.13634321368941
), x4 = c(121.44, 115.79, 75.48, 58.2, 70, 59.9, 52.6, 49.99, 
50.45, 57.59, 49.13), y = c(115.8, 75.5, 58.2, 70, 59.9, 52.6, 
50, 50.5, 57.6, 49.1, 51.1)), row.names = c(NA, -11L), class = "data.frame")



prior_intercept <- prior(normal(0, 200), class=Intercept)
prior_x1 <- prior(normal(-10,5), class=b, coef=x1)
prior_x2 <- prior(normal(0,2), class=b, coef=x2)
prior_x3 <- prior(normal(-10,5), class=b, coef=x3)
prior_x4 <- prior(normal(0.8,0.1), class=b, coef=x4)

model <- brm(y ~ x1 + x2 + x3 + x4 ,data = tes1, prior = c(prior_intercept, prior_x1, prior_x2, prior_x3, prior_x4))


Zbranco
  • 1
  • 2
  • Welcome to SO! Can you include a minimal reproducible example - see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. Can you share some sample data using `dput()` from `tes1` so that we can run your example code? – nrennie Jul 13 '23 at 19:17
  • @nrennie I'm not sure I've done what you asked me to do but I inserted some sample data in the code above. – Zbranco Jul 13 '23 at 21:58
  • It's not clear what you mean by intermediate results. Do you mean before sampling is completed? Typically people iterate when building models, often starting with fewer samples for faster diagnostics, see: https://arxiv.org/abs/2011.01808 – SushiChef Jul 27 '23 at 13:07

0 Answers0