Hi all,
I am new here and also STAN(BRMS) new user.
I saw this code online and I am trying to run the code to see if I can get the result but I am getting an error with the “mixed effect code”.
HERE IS THE CODE:
f1 <- circumference ~ phi1 / (1 + exp(-(age - phi2)/phi3))
n1 <- nls(f1,
data = Orange,
start = list(phi1 = 200, phi2 = 700, phi3 = 350))
prior_1 <- c(set_prior(“normal(200, 50)”, nlpar = “phi1”),
set_prior(“normal(700, 50)”, nlpar = “phi2”),
set_prior(“normal(350, 50)”, nlpar = “phi3”))
n1_b <- brm(bf(f1,nonlinear = phi1 + phi2 + phi3 ~ 1,nl=TRUE),
data = Orange,
prior = prior_1,
chains = 3)
summary(n1_b)
summary(n1)
##mixed effect
n2 <- nlme(f1,
data = Orange,
fixed = phi1 + phi2 + phi3 ~ 1,
random = phi1 ~ 1,
groups = ~ Tree,
start = coef(n1))
summary(n2)
# prior_1 plus prior for random effect, is there a way to update a `prior_frame` ?
prior_2 <- c(set_prior(“normal(200, 50)”, nlpar = “phi1”),
set_prior(“normal(700, 50)”, nlpar = “phi2”),
set_prior(“normal(350, 50)”, nlpar = “phi3”),
set_prior(“cauchy(30,2)”, class = “sd”))
n2_b <- brm(bf(f1, nonlinear = list(phi1 ~ (1|Tree),
phi2 ~ 1,
phi3 ~ 1),nl=TRUE),
data = Orange,
prior = prior_2,
chains = 3,
iter = 4000)
summary(n2_b)
####HERE IS THE ERROR###
Error: The following priors do not correspond to any model parameter:
sd ~ cauchy(30,2)
Function ‘get_prior’ might be helpful to you.
SOMEONE SHOULD PLEASE HELP ME OUT.
I am using brm 2.11.1