About a month ago, my code for running “loo” on a model created using the BRMS function worked just fine, but now I am getting an error:
(loo1 <- loo(fit1))
Error: ‘loo.default’ is not implemented yet
There is no issue with the models themselves as far as I can tell. I have tried updating brms, rstan, loo, R, and RStudio. I also updated my operating system to Catalina (working with a Mac). The same error message came up before and after these updates.
This is one of the first times I’ve posted here, so feel free to help me make this more reproducible if needed. The .csv file of the data and the code are attached. Meineke_sampledata.csv (1.6 MB) Meineke_samplecode.R (866 Bytes)
Hi, I tried your data and .R scripts and it worked perfectly fine for me. I’d suggest you clear your workspace and maybe try restarting your R session. Here’s what I got from loo
> loo1
Computed from 4000 by 1047 log-likelihood matrix
Estimate SE
elpd_loo -1685.5 27.5
p_loo 9.1 0.5
looic 3371.1 55.1
------
Monte Carlo SE of elpd_loo is 0.0.
All Pareto k estimates are good (k < 0.5).
See help('pareto-k-diagnostic') for details.
> loo2
Computed from 4000 by 1047 log-likelihood matrix
Estimate SE
elpd_loo -1684.9 27.6
p_loo 8.7 0.5
looic 3369.8 55.2
------
Monte Carlo SE of elpd_loo is 0.0.
All Pareto k estimates are good (k < 0.5).
See help('pareto-k-diagnostic') for details.
> loo_compare(loo1, loo2)
elpd_diff se_diff
fit_phen 0.0 0.0
fit_season -0.7 4.3
I ran the following code and restarted my R session afterward:
rm(list = ls(all.names = TRUE)) #will clear all objects includes hidden objects.
gc() #free up memrory and report the memory usage.
When I load all of the packages I was using into my workspace, something happens and loo gives me the same error I described in my initial message. The only way I’m able to fix it is to run the above code and load “brms”, “rstan”, and “loo” as the only packages in my workspace.