Generate log-likelihood for subsequent use by calling brm() then make_stancode()

Hello,

I use brms to generate stan code and stan data on my local machine. I then transfer both to an ubuntu virtual machine (VM) and run the models using cmdstanr. We are struggling to install brms on the VM, which is why we used this option. This works really well for model results and diagnostics, but makes it difficult to calculate loo.

Is there an option somewhere in brms to add calculation of the log-likelihood to the generated quantities block in the stan model that brms produces? I couldn’t see this anywhere in the options. Presumably there must be brms code which generates the stan log-likelihood code for a given model, since there is the brms::logLik.brmsfit function?

I appreciate that this might be a fairly unusual case so this might not be something anyone else wants to spend time on.

Best wishes,
David

Hello,
Just to say that we have managed to get BRMS working on our VM so no longer have a use case for this.
Hope no-one has spent time on it!
best wishes,
David

Hi David,

I think brms has the function for calculating the likelihood function(other wise it is impossible to perform loo/bayes factor analysis, right?), this log_lik function: Compute the Pointwise Log-Likelihood — log_lik.brmsfit • brms can calculate the point-wise likelihood

Best,