Hi
I’m a completely new to using brms. Here is the structure of my data:
24 months of Sales Data at a DMA(dma) level (Designated-Marketing-Area), 24 months of TV grps raw and adstocked, Paid Search Clicks and Impressions, Display Ad Clicks and Impressions. Each of the DMAs are categorized uniquely into one of the 9 US Census regions (region: factor variable). There also is a 3 level factor variable to categorize threat of Competitor activity (threat: factor variable) in a given DMA as Low, Medium, High
Reading the brms documentation I could come up with the following model for brms
library(brms)
model1 <- brm( sales ~ 1 + tvgrps_70 + search_40 + display_30 + (0 + 1|region) + (0 + 1|threat), data = dmadatadf)
How do I specify that the data is a time-series of 24 months where the unit of analysis is DMA? I know that my model specification will be incorrect without the time component. Can anyone provide guidance or introductory links?
I saw @paul.buerkner is active here. Thank you for your lovely package. Not being well versed in programming, tools such as Winbugs or RStan are a little intimidating for me. Your package has been so helpful to get introduced to Stan using lme4 style syntax.
Thank you - Rahul.
You are much more likely to get help with brms, if you post in the “Interfaces -> brms” category. I moved your post there, but I can’t help directly - maybe @jonah is not busy and can help?
I cannot be of much help here, but what I can say is that the same syntax that lme4 uses applies to brms as well (within the range of what you are currently doing). So you can safely go from lme4 to brms syntax. I don’t see what you are trying to do with (0 + 1|region) and (0 + 1|threat) though. What is the 0 +1 supposed to mean?
@martinmodrak thank you for your help in moving the I will be mindful next time around.
@paul.buerkner thank you so much for your brms package. Thank you for getting back to me here. I can explain better what I’m trying to do. I’m trying to estimate a multi-level / mixed effects model where I can include / specify auto-regressive error within each DMA. I read that lme4 allows estimation of G-side effects but not R-side effects and I have subsequently learned I can use nlme to specify AR(1) error for within subjectresiduals. I was wondering, how I might specify AR(1) within subject error in brms when working with panel data.
To clarify the syntax I used (0 + 1|DMA) and (0 + 1|threat) was incorrect. I wanted to say (0 + tvadstock|DMA) to specify a random beta by DMA but without a random intercept by DMA. Kindly let me know if I’m doing this wrong.
Rahuk