Rely more on posterior
Uses more posterior functions in monitor.R for various functions. Exported functions are replaced with minimal wrappers, others are removed.
There are no tests for monitor.R, but running some examples seems to be ok. I can add tests if required (probably just snapshots using those examples).
Fixes #1169.
@jgabry @avehtari
Oh and posterior also needs to be added to the DESCRIPTION file
I added a snapshot based on an example model Jonah wrote for monitor(), but I still haven't figured out how to load rstan locally so the true value needs to set once.
I think for testing monitor we should pass it a fixed set of posterior draws instead of creating a stanfit object (it can handle both). That's because with different hardware and different compilers results can be slightly different. So we'd have to set a tolerance but that could be fragile. I just pushed a commit that updates the test to do this.
@bgoodri When reviewing this PR I noticed that the monitor function is a bit of a mess (not @VisruthSK's fault, this was the case before this PR). I don't understand why there's a probs argument but then 0.05, 0.5, and 0.95, are also hardcoded internally to always be used. This duplicates 0.5, which is already included in the default probs, and would duplicate the users input if they put 0.05 or 0.95 in probs. Also the printing is messed up so not all the quantiles are even printed, which is perhaps why this wasn't noticed. I think a better way is to just have a probs argument (keeping current defaults) and use whatever is in probs without forcing anything internally. I'm going to push a commit to this branch that does this, but we can revert if you know of a reason for all this that I'm overlooking or if you have a better idea.
Thanks for generating the snapshot.