I am adapting this vignette to my context: https://mc-stan.org/loo/articles/loo2-lfo.html
I fit a model in rstanarm: fit <- stan_glmer(…)
but then the update() function doesn’t work, as in this line from the vignette:
fit_i <- update(fit, newdata = df[-(i:N), ], recompile = FALSE)
returns an error: “Error: passing unknown arguments: newdata, recompile.”
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.2
What happens when you just type
update into R?
update from stats doesn’t accept
recompile, those are rstan instructions.
Why wouldn’t we be using
posterior_predict.stanreg in this case?
the code you see in the case study is for brms not for rstanarm. recompile is not required for rstanarm. the rest you will likely find at ?update.stanreg
yes, I see that the case study uses brms, not rstanarm. I’m wondering what the equivalent line of code would be with fit from rstanarm. I see that recompile isn’t required, but what is the equivalent to "newdata = "? Thank you!!
Update on update()! thanks for Ben Goodrich:
This works: fit_i <- update(fit, data = df[-(i:N),])
In other words, to switch the update() from brms to stan_glmer:
newdata = --> data = , and
remove recompile = .
@bgoodri and @jonah might be able to help you with this. I am not that familiar with many rstanarm details.