Dear Stan/brms experts,
I am using the brms to fit a expected utility / prospect theory model to the choice data of risky decision-making task. However, when i tried to compare different types of model, i found the brms did not return the log-likelihood. Here is my model syntax:
## fit expected utility model with brms
# model1: simple expected utility model
m1 = bf(choice ~ inv_logit(5*inv_logit(gamma) * (P1 * (O1^(2*inv_logit(alpha)))-P2 * (O2^(2*inv_logit(alpha))))),
gamma ~ (1|sub),
alpha ~ (1|sub),
nl = TRUE)
m1_explict_fit = brm(m1,
data = exp1_explict, family = bernoulli(link='identity'),
prior = c(prior(normal(0,3), class = "b", nlpar = 'alpha'),
prior(normal(0,3),class = "b", nlpar = 'gamma')),
init = "0",
chains = 4, iter = 6000, warmup=2000, cores = 4)
brms::log_lik(m1_explict_fit)
I have the following error when i try to compute waic or get the log-likelihood:
brms::log_lik(m1_explict_fit)
Error in inv_logit(5 * inv_logit(gamma) * (P1 * (O1^(2 * inv_logit(alpha))) - :
could not find function "inv_logit"
Most likely this is because you used a Stan function in the non-linear model formula that is not defined in R. If this is a user-defined function, please run 'expose_functions(., vectorize = TRUE)' on your fitted model and try again.
Error in dim(eta) <- dim_eta :
dims [product 63360000] do not match the length of object [1]
Thanks in advance!
Best,