Extract log_lik that can be used with loo::loo

I’m having issues with the brms::loo (https://github.com/paul-buerkner/brms/issues/769), and in the meanwhile I’m looking for a workaround using loo::loo

I see that there is a brms::log_lik, but it’s not very documented, and it returns a strange object. I’m looking for a way to extact the log likelihood of a brms model in a similar way to loo:extract_log_lik so that I can feed it to a loo::loo() function.


I haven’t looked at your issue yet, but brms:::log_lik should return exactly that object, which you can pass to loo::loo (unless you set pointwise = TRUE).

And if I use pointwise=TRUE? I have too many parameters and iterations in the model for my memory…

Then it returns something to be passed to loo.function. You can see how that works in https://github.com/paul-buerkner/brms/blob/master/R/loo-helpers.R