sambrilleman / rstanarm

rstanarm R package for Bayesian applied regression modeling
http://mc-stan.org/interfaces/rstanarm.html
GNU General Public License v3.0
0 stars 1 forks source link

Implement posterior_predict & posterior survfit #20

Closed jburos closed 7 years ago

jburos commented 7 years ago

This is a placeholder for work to first update and then migrate the posterior_predict functions from http://github.com/sambrilleman/rstanjm repo to this fork.

Quoting Sam:

I think having some posterior predictions would help ..., so I think I will spend some time over this week trying to get the posterior_predict and posterior_survfit functions working with the most recent version of stan_jm, and then push them to the rstanarm fork once they are ready.

sambrilleman commented 7 years ago

Just an update. I've added posterior_predict functionality for stanjm objects. To do this I have adapted the posterior_predict method for stanreg objects, so that m can be passed an additional argument. This saves having to actually create a posterior_predict method for stanjm objects.

I have then added a new function call posterior_traj, which acts as a wrapper for posterior_predict. The details of this function are in the help file. There is also an associated plot method for objects returned by the posterior_traj function, called plot.predict.stanjm (which also has help documentation).

I've not added posterior predictions for the survival submodel yet.

At some point we will need to ask Ben/Jonah how they feel about adding plot methods for these objects to rstanarm. My impression is that they are trying to avoid having plot methods in rstanarm, and instead moving them to the bayesplot package and calling them from there.

sambrilleman commented 7 years ago

Just to confirm I've merged these additions into the following branch:

https://github.com/sambrilleman/rstanarm/tree/develop

jburos commented 7 years ago

This looks great - thanks @sambrilleman! This will be very useful.

Re plotting: maybe open an issue with Ben /Jonah re using bayesplot? A set of survival-related plot functions may be relevant, given the they are planning to eventually add basic survival analysis to rstanarm - see stan-dev/rstanarm#69

sambrilleman commented 7 years ago

This should now be close I hope. I've added the following on the develop branch:

All of these should have documentation with them.

sambrilleman commented 7 years ago

I'll wait until we've had a chance to check this stuff, and then close this issue once we merge the develop branch into the master branch.

sambrilleman commented 7 years ago

The commit here brings most of this functionality into the master branch (merging develop4 into the master), so I will close this issue now since it is quite general. We can open new issues related to specific to bugs in any of these functions, as we find them.