ability_eap

def ability_eap(dataset, difficulty, discrimination, options=None)

Estimates the abilities for dichotomous models.

Estimates the ability parameters (theta) for dichotomous models via expaected a posterior likelihood estimation.

Args

dataset
[n_items, n_participants] (2d Array) of measured responses
difficulty
(1d Array) of difficulty parameters for each item
discrimination
(1d Array) of disrimination parameters for each item
options
dictionary with updates to default options

Returns

abilities
(1d array) estimated abilities

Options

  • distribution: callable
  • quadrature_bounds: (float, float)
  • quadrature_n: int
Expand source code
def ability_eap(dataset, difficulty, discrimination, options=None):
    """Estimates the abilities for dichotomous models.

    Estimates the ability parameters (theta) for dichotomous models via
    expaected a posterior likelihood estimation.

    Args:
        dataset: [n_items, n_participants] (2d Array) of measured responses
        difficulty: (1d Array) of difficulty parameters for each item
        discrimination: (1d Array) of disrimination parameters for each item
        options: dictionary with updates to default options

    Returns:
        abilities: (1d array) estimated abilities

    Options:
        * distribution: callable
        * quadrature_bounds: (float, float)
        * quadrature_n: int

    """
    options = validate_estimation_options(options)
    quad_start, quad_stop = options['quadrature_bounds']
    quad_n = options['quadrature_n']

    if np.atleast_1d(discrimination).size == 1:
        discrimination = np.full(dataset.shape[0], discrimination,
                                 dtype='float')

    the_sign = convert_responses_to_kernel_sign(dataset)

    theta = _get_quadrature_points(quad_n, quad_start, quad_stop)
    partial_int = _compute_partial_integral(
        theta, difficulty, discrimination, the_sign)

    # Weight by the input ability distribution
    partial_int *= options['distribution'](theta)

    # Compute the denominator
    denominator = integrate.fixed_quad(
        lambda x: partial_int, quad_start, quad_stop, n=quad_n)[0]

    # compute the numerator
    partial_int *= theta

    numerator = integrate.fixed_quad(
        lambda x: partial_int, quad_start, quad_stop, n=quad_n)[0]

    return numerator / denominator
Last modified April 7, 2020: Updating documentation. (3da0254)