18 lines
746 B
Python
18 lines
746 B
Python
from lib.irt.models.three_parameter_logistic import ThreeParameterLogistic
|
|
|
|
class ItemInformationFunction():
|
|
def __init__(self, irt_model):
|
|
self.model_data = irt_model
|
|
|
|
# determines the amount of information for a given question at a given theta (ability level)
|
|
# further detailed on page 161, equation 4 here:
|
|
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978482/pdf/10.1177_0146621615613308.pdf
|
|
def calculate(self, **kwargs):
|
|
if self.model_data.model == '3PL':
|
|
p = ThreeParameterLogistic(self.model_data, kwargs).result()
|
|
q = 1 - p
|
|
return (self.model_data.a_param * q * (p - self.model_data.c_param)**2) / (p * ((1 - self.model_data.c_param)**2))
|
|
else:
|
|
# potentially error out
|
|
return None
|