Print model parameters after processing



After running a model for a long time, I tried dumping out the parameters using bin/stansummary output.csv and got

Error: error reading header
libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: Error with header of input file in parse
Abort trap: 6

I tried running against the result of the bernoulli sample and it showed the parameter fine.

What can I do with this error?


output.csv ist just a text file (comma separated values).
If you are using linux, “less output.csv”. If you are using windows, point your favourite editor at the file. If you are using a Mac, there is time to buy something else.

At the top, you should have comment lines, introduced with a hash. That look like,

# stan_version_major = 2
# stan_version_minor = 14
# stan_version_patch = 0
# model = ...

You should then see a non comment line like


and eventually your values. At the end are some more comments with run-time information.
Check if the first few lines look OK.

Have you moved the file between operating systems ? Depending on what kind of readline()/getline(), … is used, different newline terminators can confuse some readers.


after the line

refresh = 100 (Default)

I see a section of binary values shown as lots of @. After that, the rows of numbers start. Is that normal?

I don’t see the lp__,accept_stat__,stepsize__,treedepth__,n_le… line


I think this output.csv is simply corrupted. My other run on a linux system generates readable output.


I have seen output.csv corrupted if there were multiple processes running at the same time writing to the same output.csv


You need to explicitly specify different output files for each chain run in parallel through CmdStan.