API
AbstractItemResponseModels.Continuous Type
Continous <: ResponseType
Defines that an ItemResponseModel
has a continous response variable.
AbstractItemResponseModels.Dichotomous Type
Dichotomous <: ResponseType
Defines that an ItemResponseModel
has a binary response variable.
AbstractItemResponseModels.DistributionEstimate Type
DistributionEstimate <: EstimationType
Defines that the parameters of an ItemResponseModel
are estimated by a distribution. Thus, parameters for a model with estimation_type(model) == DistributionEstimate
are probability distributions that implement common interface functions for distributions, e.g. rand
, mean
, or quantile
.
AbstractItemResponseModels.EstimationType Type
EstimationType
The EstimationType
of an ItemResponseModel
describes the type of parameter estimation for the model.
AbstractItemResponseModels.ItemResponseModel Type
ItemResponseModel
An abstract type representing an item response theory model.
Each implementation T <: ItemResponseModel
must define the following traits:
response_type
: A validResponseType
person_dimensionality
: The number of dimensions for the person parametersitem_dimensionality
: The number of dimensions for the item parametersestimation_type
: A validEstimationType
Additionally T <: ItemResponseModel
must implement the following interface:
irf
: An item response function returning the probability that a person with given ability estimate will answer an item with a particular response.iif
: An item information function returning the information of answering with a particular response on an item given an ability estimate.expected_score
: An expected score function returning the expected score for one or multiple items, given an ability estimate.information
: An information function returning the information of one or multiple items, given an ability estimate.fit
: A function fitting an item response model of typeT
to observed data.get_item_locations
: A function returning the item locations for a given item.get_person_locations
: A function returning the person locations for a given person.
AbstractItemResponseModels.Nominal Type
Nominal <: ResponseType
Defines that an ItemResponseModel
has an unordered categorical response variable.
AbstractItemResponseModels.Ordinal Type
Ordinal <: ResponseType
Defines that an ItemResponseModel
has an ordered categorical response variable.
AbstractItemResponseModels.PointEstimate Type
PointEstimate <: EstimationType
Defines that the parameters of an ItemResponseModel
are estimated by a single point estimate. Thus, parameters for a model with estimation_type(model) == PointEstimate
are single real-valued numbers.
AbstractItemResponseModels.ResponseType Type
ResponseType
The ResponseType
defines the scale level of item responses for a given ItemResponseModel
.
AbstractItemResponseModels.SamplingEstimate Type
SamplingEstimate <: EstimationType
Defines that the parameters of an ItemResponseModel
are estimated by a sampling procedure. Thus, parameters for a model with estimation_type(model) == SamplingEstimate
are vectors of real-valued numbers where the length of the parameter vector is equal to the number of samples drawn.
AbstractItemResponseModels.check_response_type Method
check_response_type(::T, itr) where {T<:ResponseType}
Check if the responses in itr
are valid for ResponseType
T
.
If all responses are valid, nothing
is returned.
If any invalid responses are found, a DomainError
is thrown.
AbstractItemResponseModels.dimensionality Method
dimensionality
Return a tuple of the dimensions for an ItemResponseModel
where the first element corresponds to the person dimensionality and the second element to the item dimensionality.
AbstractItemResponseModels.each_item_index Method
each_item_index(model::ItemResponseModel)
Create an iterable object visiting each item index of an item response model.
AbstractItemResponseModels.each_person_index Method
each_person_index(model::ItemResponseModel)
Create an iterable object visiting each person index of an item response model.
AbstractItemResponseModels.estimation_type Method
estimation_type(model::ItemResponseModel)
Return the EstimationType
of an [ItemResponseModel
].
AbstractItemResponseModels.expected_score Function
expected_score(model::ItemResponseModel, theta; scoring_function)
expected_score(model::ItemResponseModel, theta, is; scoring_function)
Calculate the expected score of an ItemResponseModel
.
Arguments
model
: AnItemResponseModel
theta
: The person parameter value(s)is
: One or multiple item identifiers. Ifis
is omitted, the expected score for the whole test is returned.
Keyword arguments
scoring_function
: A binary function of the formf(y, ctx) = x
, mapping all possible response valuesy
to
a value x
. The argument ctx
contains the current item context.
Return values
If estimation_type(model) == PointEstimate
then expected_score
must return a single scalar value.
If estimation_type(model) == SamplingEstimate
then expected_score
must return a vector of values with the length equal to the number of samples drawn.
AbstractItemResponseModels.get_item_locations Method
get_item_locations(model::ItemResponseModel, i)
Get the item locations for an item from an ItemResponseModel
.
Arguments
model
: AnItemResponseModel
i
: A unique item identifier
Return values
If item_dimensionality(model) == Univariate
and estimation_type(model) == PointEstimate
then get_item_locations
must return a single scalar value.
If item_dimensionality(model) == Multivariate
and estimation_type(model) == PointEstimate
then get_item_locations
must return a vector of values corresponding to the dimensionality of the item parameters.
If item_dimensionality(model) == Univariate
and estimation_type(model) == SamplingEstimate
then get_item_locations
must return a vector of values with the length equal to the number of samples drawn.
If item_dimensionality(model) == Multivariate
and estimation_type(model) == SamplingEstimate
then get_item_locations
must return a matrix with rows corresponding to the drawn samples and columns corresponding to the dimension of the item parameter.
AbstractItemResponseModels.get_person_locations Method
get_person_locations(model::ItemResponseModel, p)
Get the person locations for an person from an ItemResponseModel
.
Arguments
model
: AnItemResponseModel
p
: A unique person identifier
Return values
If person_dimensionality(model) == Univariate
and estimation_type(model) == PointEstimate
then get_person_locations
must return a single scalar value.
If person_dimensionality(model) == Multivariate
and estimation_type(model) == PointEstimate
then get_person_locations
must return a vector of values corresponding to the dimensionality of the person parameters.
If person_dimensionality(model) == Univariate
and estimation_type(model) == SamplingEstimate
then get_person_locations
must return a vector of values with the length equal to the number of samples drawn.
If person_dimensionality(model) == Multivariate
and estimation_type(model) == SamplingEstimate
then get_person_locations
must return a matrix with rows corresponding to the drawn samples and columns corresponding to the dimension of the person parameter.
AbstractItemResponseModels.iif Function
iif(model::ItemResponseModel, theta, i)
iif(model::ItemResponseModel, theta, i, y)
Arguments
model
: AnItemResponseModel
theta
: The person parameter value(s)i
: A unique item identifiery
: Response value(s)
Return values
If estimation_type(model) == PointEstimate
then the item information function must return a scalar value.
If estimation_type(model) == SamplingEstimate
then the item information function must return a vector of values with the length equal to the number of samples drawn.
AbstractItemResponseModels.information Function
information(model::ItemResponseModel, theta; scoring_function)
information(model::ItemResponseModel, theta, is; scoring_function)
Calculate the information of an ItemResponseModel
.
Arguments
theta
: The person parameter value(s)is
: One or multiple item identifiers. Ifis
is omitted, the information of the whole test (test information) is returned.
Keyword arguments
scoring_function
: A binary function of the formf(y, ctx) = x
, mapping all possible response valuesy
to
a value x
. The argument ctx
contains the current item context.
Return values
If estimatione_type(model) == PointEstimate
then information
must return a single scalar value.
If estimation_type(model) == SamplingEstimate
then information
must return a vector of values with the length equal to the number of samples drawn.
AbstractItemResponseModels.irf Function
irf(model::ItemResponseModel, theta, i)
irf(model::ItemResponseModel, theta, i, y)
Evaluate the item response function of an ItemResponseModel
.
Arguments
model
: AnItemResponseModel
theta
: The person parameter value(s)i
: A unique item identifiery
: Response value(s)
Return values
If estimation_type(model) == PointEstimate
then the item response function must return a scalar value.
If estimation_type(model) == SamplingEstimate
then the item response function must return a vector of values with the length equal to the number of samples.
AbstractItemResponseModels.item_dimensionality Method
item_dimensionality(model::ItemResponseModel)
Return the number of dimensions for the item parameters of an ItemResponseModel
as an integer.
AbstractItemResponseModels.person_dimensionality Method
person_dimensionality(model::ItemResponseModel)
Return the number of dimensions for the person parameters of an ItemResponseModel
as an integer.
AbstractItemResponseModels.response_type Method
response_type(model::ItemResponseModel)
response_type(::Type{<:ItemResponseModel})
Return the ResponseType
of an ItemResponseModel
.
StatsAPI.fit Function
fit(::Type{T}, data::AbstractMatrix, args...; kwargs...)
Fit an item response model to response data.
Arguments
data
: The observed response data. Ifdata
is a response matrix, the columns must describe items and rows describe persons.args...
: Additional arguments required to fit theItemResponseModel
Keyword arguments
kwargs...
: Additional keyword arguments required to fit theItemResponseModel
Return values
A fitted model with T <: ItemResponseModel
.
AbstractItemResponseModels.Tests.FakeIRM Type
FakeIRM{RT<:ResponseType,PD<:Dimensionality,ID<:Dimensionality}
A minimal implementation of ItemResponseModel
for interface testing.
AbstractItemResponseModels.Tests.test_interface Method
test_interface(T::Type{<:ItemResponseModel}, data, args...; kwargs...)
Test the implementation of an item response model interface.
Arguments
T
: The implemented model typedata
: observed dataargs...
: Additional arguments passed tofit
Keyword arguments
kwargs...
: Additional keyword arguments passed tofit