Hi all, this is my coding. It returned to have error when I tried to fit in the laplace prior. Can you help?
library(rstan)
library(brms)
bayes_model_pre<- brm(
formula=bayes_formula_pre,
data = trainData,
family = bernoulli(link=“logit”),
prior = c(
set_prior(“normal(0, 5)”, class = “Intercept”),
set_prior(“laplace(0, 1)”, class = “b”)
),
chains = 4,
iter = 2000,
warmup = 500,
seed = 123
)
Error:
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
0
Semantic error in ‘string’, line 26, column 12 to column 34:
24: transformed parameters {
25: real lprior = 0; // prior contributions to the log posterior
26: lprior += laplace_lpdf(b | 0, 1);
^
27: lprior += normal_lpdf(Intercept | 0, 5);
28: }
A returning function was expected but an undeclared identifier ‘laplace_lpdf’ was supplied.
print(summary(bayes_model_pre), digits = 5)