4
$\begingroup$

The brms package is an R package for fitting Bayesian models using lme4-like syntax using Stan as the back-end. In the package, there is an option to fit a model without specifying any priors. In this case, according to the documentation, the package by default selects noninformative or weakly informative priors. In particular, according to a vignette, for population-level parameters the default is improper, and for group-level parameters the default for the SD is a Student's t.

As I fit a model using the default priors (having no prior information to speak of), I would like to see what the priors used actually were. The function prior_summary prints out the priors used after fitting the model.

However, I'm having trouble understanding the printout. Here it is, and the model is distance | cens(censored) ~ (segdist + tonedist | participant) + (1|variable):

                  prior     class      coef       group resp dpar nlpar bound
1   student_t(3, 4, 10) Intercept                                            
2  lkj_corr_cholesky(1)         L                                            
3                               L           participant                      
4   student_t(3, 0, 10)        sd                                            
5                              sd           participant                      
6                              sd Intercept participant                      
7                              sd   segdist participant                      
8                              sd  tonedist participant                      
9                              sd              variable                      
10                             sd Intercept    variable                      
11  student_t(3, 0, 10)     sigma                                            

As you can see, there many lines without any prior specified. I have thought of two reasons for this:

Possibility 1: Those blank lines were fit with improper priors. One reason for thinking this is that there is an all parameter in the function, which the documentation describes as follows: 'Logical; Show all parameters in the model which may have priors (TRUE) or only those with proper priors (FALSE)?'. After setting it to FALSE, all lines but 1, 2, 4 and 11 were removed, seemingly implying that they have improper priors.

However, this seems strange as the SDs had an improper prior, which they're not supposed to. Moreover, I'm not sure what lines like 3, 4, 5 and 9 actually are. 4 in particular cannot refer to the model's residual standard deviation since that's sigma, so it's not clear what a population-level sd is doing here.

Possibility 2: Lines 2 and 4 are headers, and imply that all the following lines have that prior. This seems to make sense in the case of line 2. Assuming that L in the class column is a stand-in for cor (correlations; I couldn't find an L class anywhere in the documentation), the prior makes sense. (I only have correlations in the participant groupings since for variable, there is just a random intercept.) Similarly, all the group-level effects have Student's t priors, which is expected behaviour.

This is what I feel is the more sensible guess. It doesn't explain the strange behaviour of all, though, since lines 3 and 5-10 would have proper priors, and should show up even when all=FALSE according to the documentation. Moreover, lines 5 and 9 are still slightly mysterious, although I could explain them away as 'sub-titles' which 'inherit' the prior from line 4 and 'pass them on' to the intercepts and slopes.

Are any of my guesses correct?

P.S. The doc for prior_summary is p.133 of this.

$\endgroup$
1
$\begingroup$

Possibility 2 is the correct one. Prior specification in brms is hierarchical in the sense that if a global prior for a parameter class is specified, it will be used for all coefficients of that class unless a coefficients has its own prior. In the latter case, the coefficient specific prior is used instead.

You may also extract the stan code from a fitted model object via stancode() to see what kind of priors are actually specified.

With regard to your additional questions:

Indeed L is related to the cor class, where L is the cholesky factor of the correlation matrix, which is what is actually used in the model.

I see that the documation of all is misleading. What it does is basically just to show those rows of the brmsprior object which have a non-empty prior column.

$\endgroup$
  • $\begingroup$ Thanks! Funnily enough, just a few days before you answered, I realised I could generate the Stan code for the brms models and found all out this my myself, heh :P $\endgroup$ – WavesWashSands Aug 1 '18 at 14:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.