Extract draws object for the posterior package from a stanreg object?

I’d like to extract a draws object from a stanreg object created with Rstanarm for use with the posterior package’s functions. But I don’t know how to do this, read the posterior functions reference but still have no clue. Using as_draws(stanreg_object) throws an error: Error: All variables in all chains must have the same length. Which seems strange to me, as all chains are of the same length…

The support for this will eventually be added to rstanarm (which has had unbelievable bad luck for long time to get new version to cran). Meanwhile you can use

as_draws(sanreg_object$stanfit)
1 Like