Update() in brms and rstanarm

Hello all,
I’m trying to adapt Solomon Kurz’s excellent tutorial on Bayesian power analysis here to my own project, but I’m running into trouble. Unfortunately he is using {brms} and I’m using rstanarm, and I’ve only ever used the latter. Before I try and learn a whole new package and new syntax for modeling, I figured I’d ask about the part of this function that is giving me trouble…

The function below is passed to another command, which then outputs a nested tibble of models containing many simulated posterior draws. This output can then be used for the power analysis. I think all of it is compatible with rstanarm, except update(). It seems the arguments for rstan’s update are different from brms.

Does anyone know if there is any easy way to adapt this section of the function, so that it has an rstan model repeatedly update the model with the same formula but new data? Or if not, is there a different way to adapt this function to play nice with rstanarm?

sim_data_fit <- function(seed, n_player) {
  n_trials <- 1
  prob_hit <- .25
  d <- tibble(y = rbinom(n    = n_player, 
                         size = n_trials, 
                         prob = prob_hit))
         newdata = d,
         seed = seed) %>% 
  posterior_samples() %>% 
  transmute(p = inv_logit_scaled(b_Intercept)) %>% 
  median_qi() %>% 

Hi Ryan,

When using update with rstanarm, you need to use the argument data, rather than newdata