R/rpcm_likelihood.R

Defines functions rpcm_log_likelihood

rpcm_log_likelihood <- function(difficulty,
                                col_sums,
                                row_sums,
                                item_time_limits,
                                factorial_like_component) {
    cll <- sum(
        (item_time_limits + difficulty) * col_sums
    ) -
        factorial_like_component -
        row_sums$compute_likelihood_component(
            difficulty,
            item_time_limits
        )
    if (is.na(cll) | !is.finite(cll)) {
        cll <- -.Machine$double.xmax
    }
    if (is.nan(cll)) {
        stop(paste("Invalid difficulty value in likelihood", toString(difficulty)))
    }
    return(-cll)
}
boweber/rpcm-tree documentation built on July 4, 2021, 1:42 p.m.