Information (Item Information Function)
Information wrt $\theta$
Psychometrics.latent_information — Methodlatent_information(examinee::AbstractExaminee, item::AbstractItem)Description
An abstraction of _latent_information(latent::AbstractLatent, parameters::AbstractParametersBinary) on an examinee and an item. It follows the parametrization $a(θ - b)$.
Arguments
examinee::AbstractExaminee: Required.item::AbstractItem: Required.
Output
A Float64 scalar.
Psychometrics.latent_information — Methodlatent_information(examinee::AbstractExaminee, items::Vector{<:AbstractItem})Description
An abstraction of _latent_information(latent::AbstractLatent, parameters::AbstractParametersBinary) on an examinee and items. It follows the parametrization $a(θ - b)$.
Arguments
examinee::AbstractExaminee: Required.items::Vector{<:AbstractItem}: Required.
Output
A Float64 vector.
Example
Compute the Fisher information for the latent/s of the examinees (second derivatives of the likelihood with respect to $heta$) and each item.
$E_ heta_n \[ I( heta_n | b_i) \]$
examinee = Examinee(); #default examinee factory
items = [Item() for i = 1 : 30]; #default item factory
latent_information(examinee, items) #compute the information wrt θ Psychometrics.latent_information — Methodlatent_information(
examinees::Vector{<:AbstractExaminee},
items::Vector{<:AbstractItem},
)Description
An abstraction of _latent_information(latent::AbstractLatent, parameters::AbstractParametersBinary) on examinees and items. It follows the parametrization $a(θ - b)$.
Arguments
examinees::Vector{<:AbstractExaminee}: Required.items::Vector{<:AbstractItem}: Required.
Output
A $N imes I$ matrix of latent informations (matrices or scalars).
examinees = [Examinee(); for n = 1 : 100]; #default examinee factory
items = [Item() for i = 1 : 30]; #default item factory
latent_information(examinees, items) #compute the information wrt θs Psychometrics.latent_information — Methodlatent_information(
latents_matrix::Matrix{Float64},
parameters_matrix::Matrix{Float64},
)Description
It computes the information function (IIF) for item parameters at latents values provided in matrix form. Not suitable for 3PL models, for such a kind of model use latent_information_3PL(). It follows the parametrization $a heta - b$. See the docs of latent_information(examinee::AbstractExaminee, item::AbstractItem) for details.
Arguments
latents_matrix::Matrix{Float64}: Required. A $ext{n_latents} imes N$ matrix with latents values.parameters_matrix::Matrix{Float64}: Required. A $( ext{n_latents} + 1) imes I$ matrix with item parameters. intercept (b) must be in first row, latents coefficients $(a_j)$ in next rows $(2, \ldots, n_latents + 1)$.
Output
A $I imes N$ Float64 matrix.
Psychometrics.latent_information_3PL — Methodlatent_information_3PL(
latents_matrix::Matrix{Float64},
parameters_matrix::Matrix{Float64},
)Description
Only for models which has guessing parameter (c) in last row of parameters_matrix. It computes the information function (IIF) for item parameters at latents values provided in matrix form. It follows the parametrization $a heta - b$.
Arguments
latents_matrix::Matrix{Float64}: Required. A $ext{n_latents} imes N$ matrix with latents values.parameters_matrix::Matrix{Float64}: Required. A $( ext{n_latents} + 1) imes I$ matrix with item parameters. intercept (b) must be in first row, latents coefficients (aj) in next rows (2, ..., nlatents + 1).
Output
A $I imes N$ Float64 matrix.
Information wrt Item Parameters
Psychometrics.item_expected_information — Methoditem_expected_information(
item::AbstractItem,
examinee::AbstractExaminee,
)Description
Abstraction of itemexpected_information(latent, parameters) on Vector{<:AbstractExaminee} and items::Vector{<:AbstractItem}. It follows the parametrization $a(θ - b)$.
Arguments
item::AbstractItem: Required.examinee::AbstractExaminee: Required.
Output
A matrix of expected informations (matrices for 2PL and 3PL or scalars 1PL).
Psychometrics.item_expected_information — Methoditem_expected_information(
items::Vector{<:AbstractItem},
examinees::Vector{<:AbstractExaminee},
)Description
Abstraction of itemexpected_information(latent, parameters) on Vector{<:AbstractExaminee} and items::Vector{<:AbstractItem}. It follows the parametrization $a(θ - b)$.
Arguments
items::Vector{<:AbstractItem}: Required. Size I x 1.examinees::Vector{<:AbstractExaminee}: Required. Size N x 1.
Output
A $N imes I$ matrix of expected informations (matrices or scalars).
```@example examinee = Examinee(1); # default examinee random factory (1-D latent) item1PL = Item(1, Parameters1PL()); # default 1PL item random factory response1PL = answer(examinee, item1PL) # generate responses itemexpinfo1PL = itemexpectedinformation(item_1PL, examinee)
item2PL = Item(1, Parameters2PL()); # default 2PL item random factory response2PL = answer(examinee, item2PL) # generate responses itemexpinfo2PL = itemexpectedinformation(item_2PL, examinee)
Psychometrics.item_observed_information — Methoditem_observed_information(
item::AbstractItem,
examinee::AbstractExaminee,
response::AbstractResponse,
)Description
It computes the item observed information for an examinee who answered response .
examinee = Examinee(1); # default examinee random factory (1-D latent)
item_2PL = Item(1, Parameters2PL()); # default 2PL item random factory
response_2PL = answer(examinee, item_2PL) # generate responses
item_obs_info_2PL = item_observed_information(item_2PL, examinee, response_2PL)
item_exp_info_2PL = item_expected_information(item_2PL, examinee)
# for 2PL and 1PL item parameters, the observed information is equal to the expected information.
@assert item_obs_info_2PL == item_exp_info_2PL
examinee = Examinee(1); # default examinee random factory (1-D latent)
item_3PL = Item(1, Parameters3PL()); # default 3PL item random factory
response_3PL = answer(examinee, item_3PL) # generate responses
# for 3PL item parameters, the observed information is different from the expected information.
item_obs_info_3PL = item_observed_information(item_3PL, examinee, response_3PL)
item_exp_info_3PL = item_expected_information(item_3PL, examinee)Psychometrics.item_observed_information — Methoditem_observed_information(
items::Vector{<:AbstractItem},
examinees::Vector{<:AbstractExaminee},
responses::Vector{<:AbstractResponse},
)Description
It computes the sum of the item observed informations across the responses. Items (latents) must be of the same type.
Example 1
examinees = [Examinee(n) for n = 1 : 100]; #default examinee factory (1-D latent)
items_2PL = [Item(i, Parameters2PL()) for i = 1 : 30]; #2PL item factory
items_3PL = [Item(i + 30, string(i + 30), Parameters3PL()) for i = 1 : 30]; #3PL item factory, id and idx must be different
items = vcat([items_2PL, items_3PL]...) # create vector of items
responses = answer(examinees, items) # generate responses
#obs_item_info = item_observed_information(items, examinees, responses) # do not run
#^ This returns an error since Julia cannot sum ``2 imes 2`` matrices with ``3 imes 3`` matrices.
# Instead do this ⌄.
obs_items_info_2PL = item_observed_information(items_2PL, examinees, responses)
obs_items_info_3PL = item_observed_information(items_3PL, examinees, responses)Example 2. Compute the standard errors of item parameter estimates using the observed responses and estimated abilities.
# The package LinearAlgebra is required to compute the inverse of the matrix.
using LinearAlgebra
# Randomly generate examinees, items and responses.
examinees = [Examinee(n) for n = 1 : 10]
items = [Item(i) for i = 1:40];
responses = answer(examinees, items);
responses_per_item = map(i -> get_responses_by_item_id(i.id, responses), items);
items_obs_info = [sum([item_observed_information(items[i], examinees[r.examinee_idx], r) for r in responses_per_item[i]] for i in 1:40];
#Using the inverse of the matrix:
inv_items_obs_info = inv.(items_obs_info);
item_parameters_standard_errors_inv = [[sqrt(i[1,1]), sqrt(i[2,2])] for i in inv_items_obs_info]
#Using the inverse of the diagonal:
item_parameters_standard_errors_diag = [[sqrt(1/i[1,1]), sqrt(1/i[2,2])] for i in items_obs_info]