Does anyone know of tools that can take in a model graph (the DAG specifying all the conditional distributions) and at least in simple enough cases, compile the graph into a Stan/BUGS/… model?
If I were to write one - would anyone have advice on how to go about doing this?
What language do you intend to write the graph in? I think the sort of cheeky/obnoxious answer here is that you could just write the graph in Stan… in fact, BUGS is quite literally a language for specifying the DAG. Stan is a bit more flexible, but retains that capability.
At the moment, it’s a list of nodes with some metadata (e.g. rv name, data type, range) and edges (rv to rv and what the conditional distributions are).
The suggestion of converting the DAGs to brms-type formulae is an excellent one! I think it might be perfect for the restricted subset of models that I’m currently using.