irt-service/app/lib/irt/test_response_function.py

24 lines
805 B
Python

from lib.irt.item_response_function import ItemResponseFunction
# otherwise known as the Test Characteristic Curve (TCC)
class TestResponseFunction():
def __init__(self, irt_model):
self.irt_model = irt_model
self.irf = ItemResponseFunction(irt_model)
# determine the probability of an individual
# at a certain theta (ability level) would get a sum of questions correct
# detailed further on page 166, equation 3 here:
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978482/pdf/10.1177_0146621615613308.pdf
def calculate(self, items, **kwargs):
sum = 0
for item in items:
result = self.irf.calculate(b_param=item.b_param,
theta=kwargs['theta'])
sum += result
return sum