- Operating System: MacOS
- brms Version: 2.13.0
Is it possible to fit a social relations model (SRM) in brms? Say I have dyadic data where y_{ij} is the total number of gifts the i\text{th} household gives to the j\text{th} household over time. The model is
\begin{align*}
y_{ij} & \sim \operatorname{Poisson}(\mu_{ij}) \\
\log(\mu_{ij}) & = \beta_0 + g_i + r_j + d_{ij} \\
\begin{pmatrix} g_i \\ r_i \end{pmatrix} & \sim \operatorname{MVN} \begin{pmatrix} \begin{bmatrix} 0 \\ 0 \end{bmatrix}, \begin{bmatrix} \sigma_g & \rho_{gr} \\ \rho_{gr} & \sigma_r \end{bmatrix} \end{pmatrix} \\
\begin{pmatrix} d_{ij} \\ d_{ji} \end{pmatrix} & \sim \operatorname{MVN} \begin{pmatrix} \begin{bmatrix} 0 \\ 0 \end{bmatrix}, \begin{bmatrix} \sigma_d & \rho_{dd} \\ \rho_{dd} & \sigma_d \end{bmatrix} \end{pmatrix},
\end{align*}
where \beta_0 is the log of the average number of gifts across dyads, g_i is the deviation for i\text{th} household to give across dyads, r_j is the deviation for j\text{th} household to receive across dyads, and d_{ij} is the dyadic-specific deviation. The data are balanced such that there are counts for all possible pairs of households in the data.
The data and model proximally come from Section 14.4 from McElreath’s 2nd edition of Statistical Rethinking. They originally come from the freely available paper by Koster and Leckie (2014, see page 102).
1 Like
I’ve played around with variations of this model in base stan, including the Hoff-style AMEN model, I put together an outline here: https://github.com/adamlauretig/AMEN_models_in_stan/blob/master/amen_model_writeup.pdf, and a dyadic version, not written up, w/R code here: https://github.com/adamlauretig/AMEN_models_in_stan/blob/master/01_create_dyadic_data.R, and stan code here: https://github.com/adamlauretig/AMEN_models_in_stan/blob/master/02_srm_stan_dyad.stan.
No BRMS implementation unfortunately, but hopefully, this can point you in the right direction?
2 Likes
If no brms solutions are forthcoming, I’m glad I can at least reference your work.
Unfortunately, I think the following not-yet-implemented feature is required to fit these models in brms: https://github.com/paul-buerkner/brms/issues/502
2 Likes
Got it. Thanks for the info, @paul.buerkner.