How to specify the prior for group-level slopes in brms

I want to model each state to have a group level slope on day, and want these slopes to come from a common distribution

y \sim a_{state} + b_{state} * day \\ a_{state} \sim normal(0, 1) \\ b_{state} \sim normal(a, \sigma) \\ a \sim normal(0, 1) \\ \sigma \sim cauchy(0, 1) \\

I tried

f = bf(y ~ (1 | state) + (0 + day | state))
m <- brm(f, df, prior = c(
  prior(normal(0, 2), class = b)
  ), cores = 4, control = list(adapt_delta = .995))

which throws an error

Error: The following priors do not correspond to any model parameter: 
b ~ normal(0, 2)
Function 'get_prior' might be helpful to you.

This gives

> get_prior(f, data = df)
                prior     class      coef group resp dpar nlpar bound
1 student_t(3, 1, 10) Intercept                                      
2 student_t(3, 0, 10)        sd                                      
3                            sd           state                      
4                            sd     day   state                      
5                            sd Intercept state                      
6 student_t(3, 0, 10)     sigma        

How can I specify the prior for group-level slopes?

You’re getting the error about the prior because you currently haven’t specified any population-level parameters (“fixed effects”) in your formula, but in your call to brm you specify a prior for a (non-existing) population-level parameter (class = b). Your formula currently only contains group-level parameters (“random effects”), which corresponds to the prior class = sd. This is what the get_prior output is telling you: If you look at the class column, it only contains a population-level intercept, group-level parameters, and noise variance sigma.

I don’t know the details of your data and model, but perhaps you also want to specify population-level parameters? For example, something like:
f <- bf(y ~ state * day + (1 + day | state))

Thank you for the answer!

When it says class = sd, I was assuming from the documentation that it’s only setting a prior for the standard deviation, rather than the group level coefficient mean value. Is that true? If so, does that mean there’s no way to set priors for mean of group level parameters?

Thanks for the recommendation bf(y ~ state * day + (1 + day | state)). That would also make sense for my model.

The group-level parameters are assumed to come from a multivariate normal distribution with mean = 0 and unknown covariance matrix. This covariance matrix is modelled as a parameter; this is why you can specify priors on the SD parameters (see the brms paper for more details).

Because the mean is zero, you can think of the group-level parameters as “adjustments” to the corresponding population-level parameter. Thus, if I’m not mistaken, you can consider the population-level coefficient as the mean of the corresponding group-level parameters. You can obviously specify a prior on that population-level coefficient, as you already did in your original post.