gbradburd/conStruct

trace plot limited to 250 iterations

karajones opened this issue · 4 comments

The number of iterations shown on the trace plots that are automatically generated during a run stops at 250 even when the number of iterations is much higher. There doesn't seem to be a way to manual change this.

The code I used:
conStruct(spatial = TRUE, K = 2, freqs = freqs, geoDist = geoDist, coords = coords, prefix = "spK2_100k", n.chains = 1, n.iter = 100000)

The resulting plot:
spK2_100k_trace.plots.chain_1.pdf

The output iterations that are being plotted are actually the sampled or thinned iterations. conStruct automatically thins the chain to keep only 500 iterations, the first 250 of which are discarded as warmup. Thinning reduces autocorrelation between MCMC steps, and also keeps output object size manageable. So, when you run a chain for 100,000 iterations, conStruct is dropping the first half of the run, then only logging every 200th iteration into its conStruct.results output object.

If you really want to see the whole chain, it'll be saved in the model.fit object, and you can access different parameters using the rstan::extract() function. But, pretty much all the information is more manageably accessed in the thinned sampling included in conStruct.results.

Let me know if you still have any questions about this, and, if not, feel free to close the issue.

Hi @karajones - just following up on this. Do you still have any questions about this issue?

Thanks for the fast response—sorry I didn't follow up sooner. It would be helpful if the documentation was clearer about this and the vignette didn't show a graph with 500 iterations since it strongly implies that the resulting graph will show all the iterations. I do think the graphs are too thinned, which makes it harder to eyeball the results looking for that nice fuzzy caterpillar, but I guess that's a matter of preference.

Hello I agree with what said here. What it's great I found this issue, because the manual has not updated on this matter.