# An ordinal 2PL model with varying thresholds and discriminations with covariates

**URL:** https://discourse.mc-stan.org/t/an-ordinal-2pl-model-with-varying-thresholds-and-discriminations-with-covariates/33900
**Category:** brms
**Tags:** brms
**Created:** [January 21, 2024, 10:20pm UTC](https://discourse.mc-stan.org/t/an-ordinal-2pl-model-with-varying-thresholds-and-discriminations-with-covariates/33900 "2024-01-21T22:20:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![llsee1883](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@llsee1883](https://discourse.mc-stan.org/u/llsee1883)
#### Post date: [January 21, 2024, 10:20pm UTC](https://discourse.mc-stan.org/t/an-ordinal-2pl-model-with-varying-thresholds-and-discriminations-with-covariates/33900/1 "2024-01-21T22:20:01Z")

</div>

Hello friends,  
I am working on a research project using multilevel item response modeling through Bayesian inference. I want to explore an ordinal 2PL model with varying thresholds and discriminations. The results of this model should have distinct threshold parameters for each response category within an item and different discrimination parameters across items.  
Based on the brms codes of an ordinal 1PL model with varying thresholds and another ordinal 2PL model with varying discriminations in Bürkner’s (2021) paper, 'Bayesian Item Response Modeling in R with arms and Stan,’ I have written the following code for this purpose and obtained some results. However, I am uncertain about the correctness of my approach.

## Fit an ordinal 2PL model with varying thresholds and discriminations

formula\_va\_ord\_thres\_2pl ← bf(  
resp| thres (gr = item) ~ 1 + (1 |i| item) + (1 | id),  
disc ~ 1 + (1 |i| item))

Additionally, I wonder if I should change the prior for the new model based on the ordinal 2PL model with varying discriminations.

## Original weakly informative priors of the ordinal 2PL models with varying discriminations:

prior\_va\_ord\_2pl ←   
prior(“constant(1)”, class = “sd”, group = “id”) +  
prior(“normal(0, 3)”, class = “sd”, group = “item”) +  
prior(“normal(0, 1)”, class = “sd”, group = “item”, dpar = "disc”)

At last, I intend to integrate person-level covariates into the above model. Do you have any recommendations for this? Can I simply include the covariates as follows?

## Use “mode” as a person-level covariate, as indicated in the paper.

formula\_va\_ord\_thres\_2pl ← bf(  
resp| thres (gr = item) ~ 1 + (1 |i| item) + (1 | id) **+ mode** ,  
disc ~ 1 + (1 |i| item))

Any help would be much appreciated!
