Individuals nested within groups

Hello!

I have data from a behavioral experiment that I wanted to model using BRMS.In the data there are data of people belonging to 4 experimental groups. Each person has 25 data points. I am trying to describe the dependent variable using the model:

ip_value = (1) / ((1 + k * delay) * (1 + h * odds)

I would like the nonlinear parameters to be modeled at two levels - the experimental groups and the individuals nested within them. I use following code:

check_fit = brm(formula = bf(ip_value ~ (1) / ((1 + k * delay) * (1 + h * odds)), k ~ 1 | condition / id, h ~ 1 | condition / id, nl = TRUE), data = sim, family = “gaussian”, chains = 2, iter = 6000, cores = 4, save_pars = save_pars(all = TRUE))

I have two questions:

  1. Does the syntax correctly reflect the structure of the model I described in terms of groups and the individuals nested within them?
  2. How should I transform the returned parameter values to get “meaningful” individual-level parameter estimates that I can feed into the model and predict a Y value from?

Below i attach the data I’m using

dataIPS.csv (159.8 KB)

  • Operating System: macOS Big Sur 11.4
  • brms Version: 2.15

I was a bit unsure at first, since the structure is typically specified with parentheses around them, like (1|higher/lower/evenlower) but for a simple nested linear regression it seems to work without parentheses. The answer is yes. You might want to model them as correlated as well, like this:

brm(formula = bf(ip_value ~ (1) / ((1 + k * delay) * (1 + h * odds)), 
                 k ~ (1 |p| condition)+(1 |q| condition:id), 
                 h ~ (1 |p| condition)+(1 |q| condition:id), 
                 nl = TRUE), 
    data = sim, 
    family = "gaussian", 
    chains = 2, 
    iter = 6000, 
    cores = 4, 
    save_pars = save_pars(all = TRUE))

Great! Thank you very much!