First time user of brms: After running a model with brms (see the model specs below)
brmsmod1 <- brm( sales ~ tvgrps_80+radiogrps_40+displaygrps_30+(tvgrps_80 | dma_id),
data = salesdat, family = gaussian(),
*warmup = 500, iter = 2000, chains = 4, *
control = list(adapt_delta = 0.97), cores=8, seed=123)
I’m able to extract random coefficients for TV grps at a DMA level using the
tvdmalevel <- ranef(brmsmod1) # separate coefficient for every one of the 220 DMAs.
I exported the data frame “tvdmalevel” to a csv file using *write.csv" command but the output file did not have the DMA_ID for 220 dmas
What am I doing wrong? Does brms have a method which will allow me to extract the ID column also to be part of the randomized coefficients output?
Thanks for your help - Rahul