Any news on that? With the loo package the only thing that we would need from a fitted greta model would be:
" An I by C by N array, where I is the number of MCMC iterations per chain, C is the number of chains, and N is the number of data points."
This could then be passed to the functions loo::loo()
and loo:relative_eff()
I tried the following naive implementation:
# simple lm example
x <- runif(100, -2, 2)
y <- rnorm(100, 1 + 2 * x, 1)
# get log-likelihood array, p(y | linpred, sd)
intercept <- normal(0, 2)
slope <- normal(0, 1)
sd_res <- cauchy(0, 2, truncation = c(0, Inf))
linpred <- intercept + slope * x
y <- as_data(y)
distribution(y) <- normal(linpred, sd_res)
loglik <- dnorm(y, linpred, sd_res, log = TRUE)
m <- model(intercept, slope, sd_res, loglik)
d <- mcmc(m)
But got the following error message:
Error: loglik is a data greta array, data greta arrays cannot be sampled
@vlandau and @nick did you implement some functions for the DIC that could be used there?