Creating a cmdstanr object from cmdstan CSVs

I am wondering if it is possible to construct a cmdstanr R6 object from cmdstan CSV files. The use case here is running a model on a cluster in MPI that I would subsequently like to make a cmdstanr model object from. I know it’s possible to create an rstan object from CSVs, but my current code is running off of cmdstanr. Cmdstanr does have a function for reading in CSVs, but no way to convert that to an actual object.

Is this a non-trivial problem or is there a helper function somewhere that could get me started?

Thanks for any help @jonah @rok_cesnovar

Here is one example for CmdStanPy, not sure if it helps.

(filepaths is a list of paths for csv files)

@saudiwin hey,

yes you can using as_cmdstan_fit(), but this is only available with the Github version of cmdstanr.

I’m running purely in R right now, but thanks!

Man you guys are really on the ball! I thought this would require a lot more plumbing. Will look into it, but that sounds like just what I need.



Hopefully it does, if not, please do open an issue.

It returns a CmdstanFit-like object that support all the cmdstanfit stuff apart from a few functions that cant be supported just from the CSV files, like $data_file() etc.