Skip to content

add as_mcmc_list function #584

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

Merged
merged 6 commits into from
Nov 5, 2021
Merged

add as_mcmc_list function #584

merged 6 commits into from
Nov 5, 2021

Conversation

MatsuuraKentaro
Copy link
Contributor

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

This as_mcmc_list function converts CmdStanMCMC object to mcmc.list object in the coda package. It is only a data conversion function, and it facilitates the transition to Stan for BUGS and JAGS users who are used to mcmc.list.

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Kentaro Matsuura

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2021

Codecov Report

Merging #584 (fe79e37) into master (137e950) will decrease coverage by 1.74%.
The diff coverage is 87.50%.

❗ Current head fe79e37 differs from pull request most recent head df74819. Consider uploading reports for the commit df74819 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #584      +/-   ##
==========================================
- Coverage   93.11%   91.36%   -1.75%     
==========================================
  Files          12       12              
  Lines        3237     3253      +16     
==========================================
- Hits         3014     2972      -42     
- Misses        223      281      +58     
Impacted Files Coverage Δ
R/utils.R 88.75% <87.50%> (-1.53%) ⬇️
R/install.R 57.56% <0.00%> (-12.47%) ⬇️
R/csv.R 97.76% <0.00%> (-0.90%) ⬇️
R/model.R 92.18% <0.00%> (-0.87%) ⬇️
R/run.R 95.23% <0.00%> (-0.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 137e950...df74819. Read the comment docs.

@jgabry jgabry linked an issue Nov 4, 2021 that may be closed by this pull request
@jgabry
Copy link
Member

jgabry commented Nov 4, 2021

Thanks @MatsuuraKentaro, this looks good! I'm going to make a few small edits and then I'll go ahead and merge this.

Also, I'm debating whether we should call this as_mcmc_list or as_mcmc.list. I prefer the underscores (_) but I still want to use the name of the actual class we're converting to, which is called mcmc.list in coda. So maybe I'll go with as_mcmc.list even though it's a bit weird.

And I'll also add an item to the NEWS.md file that mentions this and that you contributed it. Whenever we do the next official release of CmdStanR it will get included in the News section of the CmdStanR website.

@jgabry
Copy link
Member

jgabry commented Nov 4, 2021

Ok, I made a few small edits and added a few tests. I also added a comment in the documentation mentioning that this will be helpful for users of JAGS/BUGS who are familiar with coda, but I also mentioned that we do prefer the diagnostics in the posterior package and the plots in bayesplot. I mentioned that because, for example, the R-hat and effective sample size calculations in posterior use more recent (and we think improved) algorithms than the ones in coda, and bayesplot provides some HMC/NUTS specific plots that aren't available in coda but are important for Stan. But we don't want to force anyone to use bayesplot or posterior so I'm happy to have this function to make it easier to use coda for anyone who prefers that.

Now let's just let the unit tests and checks run and if everything passes we can merge it.

Thanks again @MatsuuraKentaro!

@MatsuuraKentaro
Copy link
Contributor Author

Thank you very much for the minor changes, documents and tests. That's fine.

Copy link
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok all the checks are passing so I'm going to merge. Thanks again @MatsuuraKentaro

@jgabry jgabry merged commit a767d0e into stan-dev:master Nov 5, 2021
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

Successfully merging this pull request may close these issues.

Add as.mcmc.list function for CmdStanMCMC
3 participants