# ItemResponseTrees

Item response tree (IR-tree) models like the one depicted below are a class of item response theory (IRT) models that assume that the responses to polytomous items can best be explained by multiple psychological processes (e.g., BĂ¶ckenholt, 2012; Plieninger, 2020). The package ItemResponseTrees allows to fit such IR-tree models in mirt, TAM, and Mplus (via MplusAutomation).

The package automates some of the hassle of IR-tree modeling by means of a consistent syntax. This allows new users to quickly adopt this model class, and this allows experienced users to fit many complex models effortlessly.

## Installation

You can install the released version of ItemResponseTrees from CRAN with:

`install.packages("ItemResponseTrees")`

And the development version from GitHub with:

```
# install.packages("remotes")
remotes::install_github("hplieninger/ItemResponseTrees")
```

## Example

The IR-tree model depicted above can be fit as follows. For more details, see the vignette and `?irtree_model`

.

```
library("ItemResponseTrees")
m1 <- "
Equations:
1 = (1-m)*(1-t)*e
2 = (1-m)*(1-t)*(1-e)
3 = m
4 = (1-m)*t*(1-e)
5 = (1-m)*t*e
IRT:
t BY E1, E2, E3, E4, E5, E6, E7, E8, E9;
e BY E1@1, E2@1, E3@1, E4@1, E5@1, E6@1, E7@1, E8@1, E9@1;
m BY E1@1, E2@1, E3@1, E4@1, E5@1, E6@1, E7@1, E8@1, E9@1;
Class:
Tree
"
model1 <- irtree_model(m1)
fit1 <- fit(model1, data = jackson[, paste0("E", 1:9)])
glance( fit1)
tidy( fit1, par_type = "difficulty")
augment(fit1)
```