R/mcmcirt_compute_mh.R

Defines functions mcmcirt_compute_mh

## File Name: mcmcirt_compute_mh.R
## File Version: 0.04


mcmcirt_compute_mh <- function(ll_old, ll_new)
{
    NL <- length(ll_new)
    mh <- ll_new - ll_old
    prob_mh <- ifelse(mh<0, exp(mh), 1)
    accept <- stats::runif(NL) < prob_mh
    #--- output
    ll_recent <- ifelse(accept, ll_new, ll_old)
    res <- list(accept=accept, ll_recent=ll_recent)
    return(res)
}

Try the sirt package in your browser

Any scripts or data that you put into this service are public.

sirt documentation built on Aug. 11, 2023, 5:07 p.m.