An API for item response modelling in Julia
Author JuliaPsychometrics
4 Stars
Updated Last
9 Months Ago
Started In
October 2022


Stable Dev Build Status Coverage

This package provides a generic interface for item response models in Julia. It is targeted at developers of item response model packages. Packages sucessfully implementing the AbstractItemResponseModels interface will profit from features within JuliaPsychometrics such as plotting for their item response models (e.g. via ItemResponsePlots.jl).


Creating a package using AbstractItemResponseModels requires that

  1. AbstractItemResponseModels.jl is added as a package dependency
  2. the AbstractItemResponseModels interface is implemented as described below
  3. [optional] the interface tested (also described below)


AbstractItemResponseModels offers a single abstract type defining an item response model.

abstract type ItemResponseModel end

All concrete implementations of item response models must inherit from this abstract type, e.g.

struct MyFancyIRTModel <: ItemResponseModel end


Item response models have traits attached to them allowing for flexible dispatch. AbstractItemResponseModels defines a total of 4 such traits.

Response type

Each item response model must define its response type. The response type sets the plausible values that the response data can take.

The available response types are:

abstract type Dichotomous <: ResponseType end
abstract type Nominal <: ResponseType end
abstract type Ordinal <: ResponseType end
abstract type Continuous <: ResponseType end

To define a response type for an item response model, implement the response_type function for your model such as

response_type(::Type{MyFancyIRTModel}) = Dichotomous


An item response model defines the dimensionality of both item and person parameters. The dimensionality can be univariate or multivariate.

abstract type Univariate <: Dimensionality end
abstract type Multivariate <: Dimensionality end

Define the person and item dimensionality of your model by specifying the person_dimensionality and item_dimensionality function respectively.

person_dimensionality(::Type{MyFancyIRTModel}) = Multivariate
item_dimensionality(::Type{MyFancyIRTModel}) = Univariate

Estimation type

Defining an estimation type allows dispatching based on the type of parameter estimation in an item response model. AbstractItemResponseModels differentiates between point estimation (e.g. Maximum Likelihood Estimation) and sampling based estimation such as Markov Chain Monte Carlo Methods).

abstract type PointEstimate <: EstimationType end
abstract type SamplingEstimate <: EstimationType end

The estimation type can be defined for a model via the estimation_type function.

estimation_type(::Type{MyFancyIRTModel}) = PointEstimate


Implementing the AbstractItemResponseModels interface requires defining methods for the generic functions provided in this package.

First a item response function must be provided by extending the irf generic function.

irf(model::ItemResponseModel, theta, i, y)

Further an item information function must be defined,

iif(model::ItemResponseModel, theta, i, y)

An item response model is fitted to data by a fit function,

fit(::Type{<:ItemResponseModel}, data, args...; kwargs...)

If applicable, an expected score function and an information function must be provided.

expected_score(model::ItemResponseModel, theta[, is]; scoring_function)
information(model::ItemResponseModel, theta[, is]; scoring_function)

Interface Tests

AbstractItemResponseModels provides standardized testing of the interface in a separate module Tests.

To test if your implementation of the interface is correct, add the test_interface function to your test/runtests.jl file as in the example below.

using MyFancyIRTPackage
using Test
using AbstractItemResponseModels.Tests

@testset "MyFancyIRTPackage" begin
    test_interface(MyFancyIRTModel, args...; kwargs...) 
    # additional unit tests...

If you implement multiple models in your package, make sure to call test_interface for all model types. An example of this can be seen in the RaschModels.jl package.

Required Packages

Used By Packages