Go-to modeling method for factorial experimental designs (with >2 levels)

In an experiment, two groups of patients (treatment vs. control) learn over the course of 4 sessions a memory strategy (2 x 4 design). A multilevel binomial regression appears as a reasonable model. However, I found in the literature that specifying equal priors across factor levels for factors with > 2 levels is not trivial.

We have hypotheses about both the main effect of the factor session and the sub-interactions in the treatment x session interaction (e.g. treatment_session4 x control_session3).

I found 3 modeling options in the literature:

  • using orthonormal contrast coding (Orthonormal Contrast Matrices for Bayesian Estimation — contr.orthonorm • bayestestR): this does only work for the overall effects and not for the sub-interactions (as noted in the vignette)

  • using the index variable approach illustrated in McElreaths rethinking: however, we would like to dissociate the main effects and the interaction (“interaction effect controlling for the general learning effect across the sessions”). I only found either an interaction or main effect model for such cases in the book.

  • the procedure recommended in: How to properly compare interacting levels - #6 by Solomon
    However, the credibility intervals grow very large (due to overparametrization?) so that no effects exist anymore, even though the effects are descriptively pretty large. (results printed below)

My question is: what is the standard/a reasonable option for modeling this 4x2 design? None of them seemed to really work for our data.

Code for option 3:

library(brms)
library(tidyverse)

wup <- 1000
itr <- 4000
chain <- 3
seeds <- 123
core <- 3

df <- data.frame(structure(list(VP = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                                 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
                                                 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 
                                                 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 
                                                 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
                                                 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 
                                                 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 
                                                 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
                                                 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
                                                 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
                                                 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L, 
                                                 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 
                                                 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 
                                                 17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
                                                 18L, 18L, 18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 
                                                 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 
                                                 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L, 22L, 22L, 
                                                 22L, 22L, 22L, 22L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 
                                                 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 
                                                 24L, 24L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 26L, 26L, 
                                                 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 27L, 27L, 27L, 
                                                 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 
                                                 28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 
                                                 29L, 29L, 29L, 29L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 
                                                 30L, 30L, 30L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 
                                                 31L, 31L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 
                                                 32L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 
                                                 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 35L, 
                                                 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 36L, 36L, 
                                                 36L, 36L, 36L, 36L, 36L, 36L, 36L, 37L, 37L, 37L, 37L, 37L, 37L, 
                                                 37L, 37L, 37L, 37L, 37L, 37L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 
                                                 38L, 38L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 
                                                 39L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 
                                                 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 42L, 
                                                 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 43L, 43L, 
                                                 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 44L, 44L, 44L, 
                                                 44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 45L, 45L, 45L, 45L, 
                                                 45L, 45L, 45L, 45L, 45L, 45L, 45L, 45L, 46L, 46L, 46L, 46L, 46L, 
                                                 46L, 46L, 46L, 46L, 46L, 46L, 46L, 47L, 47L, 47L, 47L, 47L, 47L, 
                                                 47L, 47L, 47L, 47L, 47L, 47L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 
                                                 48L, 48L, 48L, 48L, 48L), .Label = c("1", "2", "3", "4", "5", 
                                                                                      "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", 
                                                                                      "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", 
                                                                                      "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", 
                                                                                      "39", "40", "41", "42", "43", "44", "45", "46", "47", "48"), class = "factor"), 
                                session = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 
                                                      1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 
                                                      2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 
                                                      3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
                                                      4L, 4L, 4L), .Label = c("1", "2", "3", "4"), class = "factor"), 
                                img_50group = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 
                                                          1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 
                                                          1L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 
                                                          2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 
                                                          1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 
                                                          2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 
                                                          1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 
                                                          1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 
                                                          1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 
                                                          2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 
                                                          1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 
                                                          1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 
                                                          2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
                                                          2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 
                                                          2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 
                                                          1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 
                                                          2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 
                                                          2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 
                                                          2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 
                                                          2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 
                                                          2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
                                                          1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 
                                                          1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
                                                          2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 
                                                          1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 
                                                          2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 
                                                          1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 
                                                          1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 
                                                          1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 
                                                          2L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 
                                                          1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 
                                                          1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 
                                                          2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 
                                                          2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 
                                                          2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 
                                                          1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 
                                                          1L, 1L, 1L, 1L), .Label = c("cont", "treat"), class = "factor"), 
                                items = c(1, 2, 2, 5, 4, 4, 6, 4, 5, 5, 5, 5, 2, 2, 2, 3, 
                                          2, 4, 6, 3, 4, 7, 5, 6, 4, 7, 5, 3, 1, 2, 3, 4, 2, 5, 3, 
                                          5, 7, 7, 5, 2, 3, 3, 4, 2, 4, 5, 4, 3, 4, 6, 5, 2, 1, 2, 
                                          4, 4, 3, 5, 5, 5, 5, 5, 6, 2, 2, 1, 3, 4, 4, 4, 5, 4, 7, 
                                          6, 5, 2, 4, 4, 4, 5, 4, 6, 5, 4, 7, 4, 6, 2, 2, 4, 5, 3, 
                                          4, 3, 4, 4, 5, 6, 5, 2, 2, 3, 2, 5, 2, 5, 4, 6, 1, 1, 2, 
                                          3, 2, 3, 4, 4, 6, 5, 6, 4, 1, 2, 4, 2, 3, 5, 4, 4, 5, 5, 
                                          5, 6, 4, 3, 1, 5, 3, 3, 4, 4, 3, 5, 6, 5, 3, 3, 4, 4, 4, 
                                          5, 6, 6, 7, 3, 2, 2, 3, 3, 3, 5, 4, 4, 6, 7, 7, 2, 1, 2, 
                                          4, 4, 3, 3, 5, 4, 5, 6, 6, 4, 3, 4, 5, 4, 5, 5, 5, 4, 2, 
                                          4, 2, 4, 3, 5, 6, 5, 6, 6, 5, 6, 1, 1, 1, 4, 3, 4, 5, 4, 
                                          4, 4, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 5, 3, 3, 3, 4, 2, 2, 
                                          4, 4, 3, 3, 3, 3, 5, 5, 5, 4, 5, 6, 1, 3, 3, 3, 2, 5, 5, 
                                          4, 3, 4, 5, 5, 4, 2, 2, 2, 4, 5, 5, 4, 4, 6, 5, 6, 1, 2, 
                                          3, 3, 3, 4, 4, 4, 6, 4, 3, 1, 3, 4, 3, 4, 4, 6, 5, 5, 6, 
                                          3, 3, 2, 4, 3, 5, 5, 4, 5, 6, 6, 6, 4, 5, 4, 4, 5, 4, 5, 
                                          4, 4, 2, 2, 2, 4, 3, 2, 3, 5, 3, 6, 4, 7, 3, 3, 2, 4, 5, 
                                          3, 5, 4, 5, 5, 5, 5, 1, 2, 2, 3, 3, 3, 5, 3, 5, 6, 7, 7, 
                                          3, 2, 1, 5, 4, 3, 3, 4, 6, 4, 5, 6, 4, 1, 3, 3, 4, 3, 6, 
                                          6, 5, 6, 6, 5, 3, 3, 2, 4, 2, 4, 5, 4, 5, 4, 5, 7, 3, 1, 
                                          3, 4, 4, 5, 5, 4, 5, 6, 6, 6, 3, 3, 3, 5, 6, 4, 4, 7, 5, 
                                          3, 3, 1, 4, 4, 3, 5, 3, 4, 7, 6, 5, 4, 3, 3, 5, 5, 3, 5, 
                                          4, 5, 3, 3, 1, 4, 4, 3, 4, 4, 5, 6, 6, 7, 3, 2, 1, 4, 4, 
                                          5, 5, 3, 5, 4, 5, 7, 2, 3, 2, 4, 4, 3, 3, 5, 4, 7, 6, 6, 
                                          4, 3, 3, 4, 3, 3, 6, 6, 6, 5, 4, 5, 3, 2, 2, 5, 4, 4, 4, 
                                          4, 4, 5, 5, 4, 2, 2, 3, 3, 4, 4, 3, 5, 3, 6, 5, 6, 2, 2, 
                                          2, 3, 2, 3, 6, 3, 4, 6, 5, 7, 1, 3, 3, 4, 4, 5, 5, 4, 5, 
                                          6, 5, 6, 3, 4, 3, 3, 4, 3, 3, 4, 3, 6, 5, 5, 3, 3, 3, 4, 
                                          3, 3, 4, 3, 4, 5, 5, 4), maxitems = c(8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
                                                                                8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8)), row.names = c(NA, 
                                                                                                                                                   -537L), class = "data.frame"))


df %>% group_by(session, img_50group) %>% summarise(m = mean(items))
#> A tibble: 8 x 3
#> Groups:   session [4]
#>  session img_50group     m
#>  <fct>   <fct>       <dbl>
#>1 1       cont         1.88
#>2 1       treat        3.1 
#>3 2       cont         3.10
#>4 2       treat        4.06
#>5 3       cont         3.96
#>6 3       treat        4.95
#>7 4       cont         4.92
#>8 4       treat        6 

# from https://discourse.mc-stan.org/t/how-to-properly-compare-interacting-levels/20457/5
fit_index <- brm(data = df, 
            family = binomial,
            bf(
              items | trials(maxitems) ~ 0 + a + g + s + i, 
              g ~ 0 + img_50group,
              s ~ 0 + session,
              a ~ 0 + (1 | VP), 
              i ~ (0 + img_50group) : (0 + session),
              nl = TRUE
            ),
            prior = c(prior(exponential(1), class = sd, group = VP, nlpar = a),
                      prior(normal(0, 0.5), nlpar = g), 
                      prior(normal(0, 0.5), nlpar = s), 
                      prior(normal(0, 0.5), nlpar = i)),
            warmup = wup, 
            iter = itr, 
            chains = chain, 
            seed = seeds, 
            cores = core)
#> Compiling Stan program...
#> Start sampling

summary(fit_index)
#>  Family: binomial 
#>   Links: mu = logit 
#> Formula: items | trials(maxitems) ~ 0 + a + g + s + i 
#>          g ~ 0 + img_50group
#>          s ~ 0 + session
#>          a ~ 0 + (1 | VP)
#>          i ~ (0 + img_50group):(0 + session)
#>    Data: df (Number of observations: 537) 
#>   Draws: 3 chains, each with iter = 4000; warmup = 1000; thin = 1;
#>          total post-warmup draws = 9000
#> 
#> Group-Level Effects: 
#> ~VP (Number of levels: 48) 
#>                 Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(a_Intercept)     0.03      0.02     0.00     0.09 1.00     5433     3083
#> 
#> Population-Level Effects: 
#>                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
#> g_img_50groupcont              -0.24      0.28    -0.77     0.32 1.00     4680
#> g_img_50grouptreat              0.23      0.29    -0.32     0.80 1.00     4298
#> s_session1                     -0.54      0.33    -1.19     0.10 1.00     4888
#> s_session2                     -0.14      0.33    -0.77     0.51 1.00     5161
#> s_session3                      0.16      0.33    -0.50     0.81 1.00     4643
#> s_session4                      0.52      0.33    -0.13     1.17 1.00     4696
#> i_img_50groupcont:session1     -0.39      0.34    -1.05     0.28 1.00     5014
#> i_img_50grouptreat:session1    -0.14      0.34    -0.80     0.53 1.00     4879
#> i_img_50groupcont:session2     -0.08      0.33    -0.74     0.58 1.00     5756
#> i_img_50grouptreat:session2    -0.06      0.34    -0.73     0.61 1.00     5080
#> i_img_50groupcont:session3      0.06      0.34    -0.59     0.72 1.00     4803
#> i_img_50grouptreat:session3     0.09      0.34    -0.58     0.77 1.00     4861
#> i_img_50groupcont:session4      0.18      0.34    -0.48     0.84 1.00     5311
#> i_img_50grouptreat:session4     0.34      0.34    -0.34     1.02 1.00     5165
#>                             Tail_ESS
#> g_img_50groupcont               5534
#> g_img_50grouptreat              5366
#> s_session1                      5550
#> s_session2                      5410
#> s_session3                      5131
#> s_session4                      5581
#> i_img_50groupcont:session1      5761
#> i_img_50grouptreat:session1     5740
#> i_img_50groupcont:session2      6031
#> i_img_50grouptreat:session2     5803
#> i_img_50groupcont:session3      5809
#> i_img_50grouptreat:session3     6092
#> i_img_50groupcont:session4      6356
#> i_img_50grouptreat:session4     6170
#> 
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).

Created on 2022-07-05 by the reprex package (v2.0.1)






Please also provide the following information in addition to your question: 

* Operating System: windows 10 64 bit
* brms Version: version 2.17.0
2 Likes