Is my syntax below for an ordinal logistic model correct? I get an error message which I don't understand.I got the code from a published paper illustrating a graded response model (ordinal logistic, in other words).
# Load packages ----
library(rstan)
library(tidyverse)
library(brms)
# Bayes IRT Unidimensional 2pl GRM ----
formula_uni <- bf(
resp | thres(gr = item) ~ 1 + (1 | id),
disc ~ 1 + (1 |i| item)
)
prior_uni <-
prior("normal(0, 3)", class = "Intercept") +
prior("constant(1)", class = "sd", group = "id") +
prior("normal(0, 1)", class = "sd", group = "item", dpar = "disc")
## Posterior Samples ----
fit_uni <- brm(
formula = formula_uni,
data = tsc_dat1,
family = brmsfamily("cumulative", "logit", link_disc = "log"),
prior = prior_uni,
iter = 5000,
chains = 4,
cores = 4
)
The error message below indicates that a certain function is not found - have I just omitted to load some required package or is it something else?
Compiling Stan program...
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for:
log_inv_logit_diff(real, real)
Function log_inv_logit_diff not found.
error in 'model61a4787630c_d5da0bad07704d69638ca1b1ee168864' at line 19, column 84
-------------------------------------------------
17: return log1m_inv_logit(disc * (thres[nthres] - mu));
18: } else {
19: return log_inv_logit_diff(disc * (thres[y] - mu), disc * (thres[y - 1] - mu));
^
20: }
-------------------------------------------------
I got this error and solved it by updating rstan so likely rstan or one or more dependencies is causing this with your version of brms.