The proportion of the outcome's variance a model explains, computed
per posterior draw. A maximum-likelihood fit has one parameter
vector rather than a posterior, so this refuses on a frmtmb_fit
and names the route to draws; the estimator itself is in the
frmtmb.sample package, on the same generic.
Examples
set.seed(1)
dd <- data.frame(x = rnorm(40))
dd$y <- rnorm(40, 1 + 0.5 * dd$x, 1)
fit <- frm(bf(y ~ x) + gaussian(), data = dd)
try(bayes_R2(fit))
#> Error : bayes_R2() is computed per posterior draw and this is a maximum-likelihood fit. Install frmtmb.sample and sample first: bayes_R2(frm_sample(fit))