Database Ingest into Stan

We have some work to develop a Stan model. The data we are considering are relatively numerous (potentially more than 300 million data) and natively stored in a postgres database, which is continually evolving such that we want to run the Stan model at regular intervals. We can, of course, translate the data into whatever format we like (eg json) and then point Stan at the data, but is there a pre-existing/recommended strategy for getting the data out of the database and directly into Stan? I’m also interested in people think this is worth worrying about.

Cheers

Simon

There is nothing built in besides JSON (or the deprecated R “dump” format), but depending on how much you engineering you are willing to invest it should be possible to write a var_context implementation backed by the database. This would almost certainly be faster than serializing to/from JSON, but whether or not that is going to be worth it will depend

Thank you, @WardBrian.