Using projpred on stanfit object

I am new to using Rstan. I have built a model using rstan, and would now like to perform variable selection using the projpred package. Projpred is compatible with rstanarm and brms, however I have used rstan (I prefer it due to more flexibility). Is it possible to perform projection predictive variable selection on a stanfit object created using rstan?

Many thanks in advance

That is in principle possible, but it’s not straightforward: an old discussion gives some pointers, there’s no end-user documentation I could find about it. Perhaps @AlejandroCatalina will be able to give a more precise answer, especially regarding the current limitations on the families of models for which projective selection is supported.

Yeah, improving this documentation is something on the roadmap for sure. It is definitely possible to run projpred on a stanfit object as long as you provide the necessary functions. That is, basically, a posterior prediction function for the model and a function that extracts the offset, response values and the weights (if these apply to your model). You can take a look at the required functions in the refmodel.R file and the .init_refmodel function.

Note that only exponential family models are supported in the CRAN version.

1 Like