-
Notifications
You must be signed in to change notification settings - Fork 12
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
Devel convergence vignette #53
base: devel
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## devel #53 +/- ##
==========================================
- Coverage 65.64% 64.22% -1.42%
==========================================
Files 26 25 -1
Lines 4590 4048 -542
==========================================
- Hits 3013 2600 -413
+ Misses 1577 1448 -129
Continue to review full report at Codecov.
|
I will try to review ASAP, but I have a few urgent things to work on this week. We've been discussing a vignette where we show how to do MCMC/Bayesian modelling to baggr users who have no background in either, so this might be a good start! |
No rush, just figured it might be useful! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to delete .Rd's and check for merge errors. Vignette should open a bit differently. Otherwise it's great
bibliography: baggr.bib | ||
--- | ||
|
||
The `baggr` package makes running Bayesian meta-analysis models very easy, but that ease can also obscure some things that go on behind the scenes. Especially with low-data settings, say with only a few measurements, you may get cryptic error messages when you run your models, like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just baggr.
Please explain in the very first sentence what this vignette is about and who is it for: "This is a vignette intended for baggr users who have no or little experience with Markov Chain Monte Carlo (MCMC) programs used for Bayesian inference. It is intended to help you understand common problems that may occur when running models. Especially in when there are few data you may see cryptic error messages when you run your models, like"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that makes sense. I'll edit and re-push.
Warning: There were 110 divergent transitions after warmup. Increasing adapt_delta above 0.9 may help. See | ||
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you need to explain basic terms. In few words, as if explaining to an undergraduate. What is Stan - 1 sentence. What is it for. What is MCMC. How does baggr use Stan. Why problems can occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "here" I meant after "This vignette" paragraph. But before you go into any particualr issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that you will re-state this in more detail below, but sometimes people stop reading at first difficulty. So having a simple paragraph (it could be a bulletpointed mini-glossary?) will enable many of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is useful feedback, I'll make these changes.
|
||
This vignette will walk through the basic intuition for what those mean, whether to be concerned about them, and how to tune the parameters underneath the hood. There are already a number of good resources that go more in depth on the topic so first I'll point you there: | ||
|
||
[Visual MCMC Diagnostics Using the Bayesplot Package](https://mc-stan.org/bayesplot/articles/visual-mcmc-diagnostics.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd cite the extra resources after your basic explanations. Otherwise readers will click on them and go away
|
||
# $\widehat{R}$ being too low | ||
|
||
The other warning you get, that “r hat” statistics are too high, indicates that the effective sample size (ESS) of your draws are too low and your chains have not converged. Because MCMC is not a deterministic algorithm, we run multiple chains of samples in order to check that each has converged to a good enough answer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are 2 mutual issues? ie correlated, but can have low R hat, low ESS, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right, this is misleading at best, and at worst incorrect.
DESCRIPTION
Outdated
@@ -29,7 +29,7 @@ Imports: | |||
LinkingTo: StanHeaders (>= 2.18.1), rstan (>= 2.18.1), BH (>= 1.66.0-1), Rcpp (>= 0.12.17), RcppEigen (>= 0.3.3.4.0) | |||
SystemRequirements: GNU make | |||
NeedsCompilation: yes | |||
RoxygenNote: 6.1.1 | |||
RoxygenNote: 7.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but please remove this and also delete .Rd files. I want to update Roxygen on my end and update .Rd files after we merge. Otherwise there will be stupid clashes when merging to devel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright--I found that if I wanted linking within the documentation to work I needed to update roxygen2. I can delete the note and the .rd files though.
man/baggr.Rd
Outdated
@@ -36,7 +48,7 @@ If unspecified, the priors will be derived automatically based on data | |||
(and printed out in the console).} | |||
|
|||
\item{prior_hypersd}{prior for hyper-standard deviation, used | |||
by Rubin and \code{"mutau"`` models; same rules apply as for }_hypermean`;} | |||
by Rubin and \verb{"mutau"`` models; same rules apply as for }_hypermean`;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this OK? I don't get what is going on here. (My old code also looks broken)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might have been a case where I accidentally deleted and re-added something and it got swept up in a commit unintentionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check how it renders, I think my old code also looks wrong!
@be-green no need to delete Roxygen Note (I just updated mine to version 7 too, that was part of the problem), but for safety good to delete .Rd files as they are constantly changing in |
@be-green I'm ready to merge this, let me know if I can help in any way. I think you only need to push a few changes + get rid of .Rd files (or try re-making them first, I moved to new Roxygen so maybe you won't have conflicts with devel anymore? but if you still have problems, get rid of the .Rd offenders) |
Ok I'll make changes, delete .rd files, and push a new commit. Sorry, I've been swamped with another project this week and haven't made as much progress on this as I'd like. |
3d57a82
to
04d18b6
Compare
I need to make more edits, will not incldue this for v0.4 as I'm running out of time to review. |
Adds a vignette that helps people address and understand convergence warnings, with a brief, high-level intro to MCMC sampling and HMC to give context for why they are occurring. If this isn't useful or you have thoughts on the content (maybe I did something wrong or misrepresented something) please let me know.