Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace plot limited to 250 iterations #16

Closed
karajones opened this issue Oct 26, 2018 · 4 comments
Closed

trace plot limited to 250 iterations #16

karajones opened this issue Oct 26, 2018 · 4 comments

Comments

@karajones
Copy link

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

@gbradburd
Copy link
Owner

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.

@gbradburd
Copy link
Owner

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

@karajones
Copy link
Author

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.

@Dahn-YoungDong
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants