rasch_jml

def rasch_jml(dataset, discrimination=1, options=None)

Estimates difficulty parameters in an IRT model

Args

dataset
[items x participants] matrix of True/False Values
discrimination
scalar of discrimination used in model (default to 1)
options
dictionary with updates to default options

Returns

difficulty
(1d array) estimates of item difficulties

Options

  • max_iterations: int
Expand source code
def rasch_jml(dataset, discrimination=1, options=None):
    """ Estimates difficulty parameters in an IRT model

    Args:
        dataset: [items x participants] matrix of True/False Values
        discrimination: scalar of discrimination used in model (default to 1)
        options: dictionary with updates to default options

    Returns:
        difficulty: (1d array) estimates of item difficulties

    Options:
        * max_iterations: int
    """
    options = validate_estimation_options(options)

    # Defines item parameter update function
    def _item_min_func(n_items, alphas, thetas,
                       betas, the_sign, counts):
        # pylint: disable=cell-var-from-loop

        for ndx in range(n_items):
            scalar = alphas[0] * the_sign[ndx, :]

            def _beta_min(beta):
                otpt = 1.0 / (1.0 + np.exp(scalar *
                                           (thetas - beta)))
                return -np.log(otpt).dot(counts)

            # Solves for the beta parameters
            betas[ndx] = fminbound(_beta_min, -6, 6)

        return alphas, betas

    result = _jml_abstract(dataset, _item_min_func,
                           discrimination, options['max_iteration'])

    return result[1]
Last modified April 7, 2020: Updating documentation. (3da0254)