I’d like to combine item response theory (IRT) and growth curve estimation in the same model. Basically, I’d like to estimate a 2-parameter logistic item response model (difficulty and discrimination) and growth curves (intercepts and slopes) of participants’ latent trait levels (theta). But, I’d like to simultaneously estimate the item response model and growth curves in the same model. Is this possible in brms? Here’s a small reproducible example of an IRT model that I’d like to extend to include growth curves (using simulated longitudinal data from Phil Chalmers: https://github.com/philchalmers/mirt/blob/gh-pages/data-scripts/Longitudinal-IRT.R ; and Paul Bürkner’s example of a 2-PL item response model in his Bayesian IRT paper: https://arxiv.org/abs/1905.09501 ):

```
library("brms")
library("mirt")
library("mvtnorm")
numberItems <- 20
numberItemLevels <- 2
a <- matrix(rlnorm(numberItems, .2, .2))
d <- matrix(rnorm(numberItems*numberItemLevels), numberItems)
d <- t(apply(d, 1, sort, decreasing=TRUE))
#Simulate Data
set.seed(1)
Theta <- mvtnorm::rmvnorm(n = 1000, 0, matrix(1))
t1 <- simdata(a, d, N = 1000, itemtype = "graded", Theta = Theta)
t2 <- simdata(a, d, N = 1000, itemtype = "graded", Theta = Theta +.5 + rnorm(nrow(Theta), 0, .3))
t3 <- simdata(a, d, N = 1000, itemtype = "graded", Theta = Theta + 1 + rnorm(nrow(Theta), 0, .3))
colnames(t1) <- paste(colnames(t1), ".1", sep = "")
colnames(t2) <- paste(colnames(t2), ".2", sep = "")
colnames(t3) <- paste(colnames(t3), ".3", sep = "")
dat <- data.frame(t1, t2, t3)
dat$id <- as.factor(as.numeric(row.names(dat)))
#Wide to Long form
dat_long <- pivot_longer(dat, -id, names_to = c("item", "timepoint"), names_sep = "\\.", values_to = "response")
#Change data types
dat_long$item <- factor(dat_long$item)
dat_long$response <- factor(dat_long$response, levels = c(0,1,2), ordered = TRUE)
dat_long$timepoint <- as.numeric(dat_long$timepoint)
#Model formula
formula_va_ord_2pl <- bf(
response ~ 1 + (1 |i| item) + (1 | id),
disc ~ 1 + (1 |i| item)
)
#Fit the model
fit_va_ord_2pl <- brm(
formula = formula_va_ord_2pl,
data = dat_long,
family = brmsfamily("cumulative", "logit"),
seed = 1234
)
```

Is it possible to extend this model to estimate intercepts and slopes of participant’s latent trait levels in the same model?

For an example of a longitudinal IRT model that simultaneously estimates a 1-PL IRT model and growth curves using a mixed-effects model framework in SAS and WinBUGS, see the following paper (see example code in Appendix examples 3 and 4 on pp. 148-149):

McArdle, J. J., Grimm, K. J., Hamagami, F., Bowles, R. P., & Meredith, W. (2009). Modeling life-span growth curves of cognition using longitudinal data with multiple samples and changing scales of measurement. *Psychological Methods*, *14*, 126-149. doi: 10.1037/a0015857

Thanks in advance!