stan-dev / projpred

Projection predictive variable selection
https://mc-stan.org/projpred/
Other
110 stars 26 forks source link

Enhance some output in case of weighted projected draws (by relying on the posterior package) #439

Closed fweber144 closed 1 year ago

fweber144 commented 1 year ago

Fixes #206. There are some larger deviations from what was suggested in #206; in particular, methods and arguments for obtaining posterior-formatted output are implemented directly instead of just providing the weights of the projected draws.

The behavior of proj_predict() remains essentially unchanged because the resampling already implemented there is more desirable than a "final-step" resampling which would typically be the type of resampling conducted with the posterior package: The current resampling behavior is to resample the projected draws (yielding 1000 resampled projected draws by default) and then to draw from the posterior-projection predictive distributions (PPPDs; there is one such distribution per observation) conditional on each of these resampled projected draws in turn. What I mean with "final-step" resampling is to draw from the PPPDs conditional on the non-resampled projected draws and then to resample the draws from the PPPDs. Since this would usually give a number of unique draws from the PPPDs equal to the number of non-resampled projected draws (at least for continuous families like the Gaussian family), this "final-step" resampling is less desirable.

fweber144 commented 1 year ago

Forgot to mention that library(posterior) now needs to be run before devtools::document() in order to have comments in the "Usage" documentation section for as_draws_matrix.projection() and as_draws.projection() stating that these are S3 methods. This is purely cosmetic, however. (Running devtools::document() without library(posterior) beforehand is still possible, it just causes these cosmetic comments not to appear.)