I was wondering whether there is something like a “parameter prefix table” for brms regression models, which describes which prefixes are used for what kind of parameter types and ideally how the parameter names are built (including brackets etc).
I searched the internet and did not find any exhaustive explanation.
Is there a documentation I missed or a function in the brms package which contains this information?
brms package uses this internally: Rename Parameters — rename_pars • brms
note that brackets are just indexing, not part of the name.
I often use
tidybayes::get_variables to quickly see what the names are.
Thanks! I know this function.
My actual problem is, that I have a model which has >> 1000 Parameters. So the output of
get_variables is a pretty long vector. What I want to know is the logic how this names are built, to extract a specific subset of theses parameters - say all level 1 random effect.
So what I know are
and I want, for all my future models, a logic to build e.g. a regular expression, to extract the parameters I need. I supposed the best way to accomplish this goal is to understand the naming scheme which, I assumed, must be part oft brms, and therefore easy to get.
I believe the naming scheme is implicit in the function that @mitzimorris linked to. The code is available here:
brms/rename_pars.R at master · paul-buerkner/brms · GitHub, you may be able to read through it and determine what pattern you are looking for
@paul.buerkner may be able to weigh in if there is a better way of getting this information
the columns will be output in the order in which the variables are declared in the Stan program generated by BRMS - so if you have the generated Stan program, the ordering is described here: 19 Stan CSV File Format | CmdStan User’s Guide
brms::ranef isn’t a general solution to your question, but it might be sufficient for your use case?