I have constructed a Poisson GLM (modeling it Bayesian in brms) as a part of a social network analysis, predicting counts of outgroup/ingroup connections over two different cohorts/years of a study programme. We are investigating whether the COVID-lockdown has had any effect on how many outgroup connections a student has in general, and we have some social network collected data for this on two different cohorts (years) of the same study, one affected by the lockdown, and one unaffected.
The model contains an interaction and varying effects, and I have a hard time grasping how to write up the model and the priors in mathematical notation.
My likelihood is, as mentioned, Poisson.
Our model is like this - in R-syntax:
log ( λ_i) = Count_of_Connections ~ 0 + Year:Group + (0 + Group | ID)
And the variables are:
- Count_of_Connections discrete count of friendships
- Year: Categorical variable of 2 levels, as we have two years 2018 (unaffected by lockdown) and 2019 (affected by lockdown)
- Group: Categorical variable of 2 levels, as we have Ingroup and Outgroup, which defines whether the Connection counted is one made to a person WITHIN the assigned studygroup the student has been tied to throughout the semester, or if its a Connection made to a person OUTSIDE the assigned studygroup (more likely when there is not a lockdown, because you meet people - outside the ones you normally see - randomly at physical lectures, parties, etc.)
- ID: A personal ID for every person
Question 1: How do I write up an interaction and varying effects (i.e. this model) in mathematical notation? Google does help a little, but it seems there are many ways to do this sort of thing and not an agreed upon one way.
If interested - I have defined the following priors (vague) currently to let the data speak (here in R-syntax):
priors_for_model_main ← c(
prior(normal(1.7, 0.5), class = b, coef = year2018),
prior(normal(1.7, 0.5), class = b, coef = year2019),
prior(normal(0.5, 0.2), class = b, coef = year2018:groupoutgroup),
prior(normal(0.5, 0.2), class = b, coef = year2019:groupoutgroup),
prior(lkj(5), class = cor),
prior(normal(0, 0.1), class = sd))
Question 2 for the interested: how would one write up these priors?
There is no problems in getting the model to run - this post is only for me to learn more about how to mathematically notate this. Appreciating all help given and apologies for the R-syntax - I really want to learn how to do this, as my course in Bayesian Statistics does not have the mathematical notation as a core focus but rather the application of the methodology.