Tool to auto-generate model diagrams?

#1

Shot in the dark, but a reviewer asked for a diagram of my model, and while I could do one by hand I thought I’d check if anyone knows any tools that attempt to automate some portion of that task. Obviously a hard problem, but figured it might be common enough that someone might have tried to tackle it.

0 Likes

#2

Greta does this. It’s about midway down here under Plotting: https://greta-stats.org/articles/get_started.html

0 Likes

#3

Ah, my model was done in Stan; presumably no automatic Stan-to-Greta converters too?

0 Likes

#4

No but they do offer help for translating from Stan to Greta: https://greta-stats.org/articles/example_models.html

0 Likes

#5

I think it’d be about the same amount of work to convert (and check) the code as it would be to do then diagram by hand.

0 Likes

#6

Yeah I think the (most?) interesting aspect to Greta is using TensorFlow to fit probability models in R.

0 Likes

#7

The diagrams to which you refer are for specifying probabilistic graphical models. The Stan Modeling Language, on the other hand, is richer than just probabilistic graphical models which means that we cannot define diagrams for a general Stan program. Moreover, in turns out to be theoretically impossible to translate those limited Stan programs that are equivalent to graphical models to a graphical model and hence graphical model representations like diagrams. Heuristic translations can go a long way, but given the tricky edge cases no one has attempted anything along this line.

2 Likes

#8

Came across this nice new R-package for visualizing DAGS yesterday thanks to @bgoodri which may have been helpful to you: ggdag. The video content is here: https://youtu.be/3p5zCXoggtA?t=2483. It’s not auto-generating but it could be the best alternative in R at the moment. What did you end up using?

1 Like