Short summary of the problem
- Operating System: Arch Linux
- brms Version: github current as of 2021/12/25
I am analyzing data from an experiment on drumming precision. Each of the 20 subjects performed 75 trials in 3 sessions, and we also recorded a measure of musicality for each subject. The response variable is the timing of subject’s drumming relative to the correct timing (with negative values indicating too early responses and positive values too late responses).
A small subset of my sample data is attached.
data_subset.csv (4.9 KB)
Now, I want to model both location and scale of the response variable “deviation”.
Concerning the scale, I am interested in both within-subject and between-subject variance at the population level.
The statistical model is described here:
Regressors for the within-subject variance indicate how much the individual variance depends on a regressor at the population level (e.g., at the start of the experiment [trial=0] subjects might perform more consistently at the individual level than at the end [trial=75]—an effect possibly attributable to fatigue).
In the above cited model, the within-subject variance is the variance of the residuals, and—as far as I understand—these can be modeled with the
sigma term of brms.
Regressors for the between-subject variance indicate how much the variance at the group level depends on a regressor at the population level (e.g., at the start of the experiment [trial=0] average performance of subjects has larger variance while at the end of the experiment[trial=75] subjects perform very similarly—an effect possibly attributable to training effects in unmusical subjects).
In the above cited model, the between-subject variance is modeled as the standard deviation of the group-level intercept. I cannot figure out, if and how this could be done.
Thank you very much in advance for your help!
model <- ( # model the intercept including a group-level intercept bf(deviation ~ 1 + musicality + trial + session + (1|subject)) + # model the within-subject variance term and a group-level intercept lf(sigma ~ 1 + musicality + trial + session + (1|subject)) # now, can I also model the variance of the group-level intercept with a population level variable? # lf(sigma ~ 1 + musicality + trial + session + (1 + musicality2 |subject) # gives a musicality2 variable at the group level while I want it at the population level # governing the variance of the group-level intercept. )