Interpretation of diagnostic_file content

Dear all,

I’m trying to optimize some Gaussian process model, and I looked at the diagnostic file from Rstan.

in addition to my parameters defined in stan model, there are also variables named as g_parameter, p_parameter, what are the meanings of these?

Also, I ran 2000 iterations with 1000 warmup (default) in each chain, but there are about 5200 rows in the diagnostic file, I believe the first 2000 are my samples, what are the remaining 3200 rows for?

g_parameter is the component of the gradient corresponding to parameter, and p_parameter is the corresponding momenta. Note that these are all on the unconstrained scale.

There will not be excess rows, just one for each sample. My guess is that you’re either appending to an existing diagnostic file (i.e. you didn’t clear it between runs) or you’re concatenating the diagnostics from multiple chains.

Please see the new GP section in the 2.16.0 version of the Stan manual for information on how to build robust GP models.


and you are right, I did ran two sessions and they were writing to the same file…