get.log_lik: Extract pointwise log-likelihood matrix

View source: R/S3loo.R

get.log_likR Documentation

Extract pointwise log-likelihood matrix

Description

For Stan-fitted models, returns the posterior draws of pointwise log-likelihood (an S \times N_{\text{obs}} matrix for most models, or S \times N for FCDCM and FCGDINA). For EM and iStEM fits, returns NULL.

Usage

get.log_lik(object, ...)

## Default S3 method:
get.log_lik(object, ...)

Arguments

object

A fitted ForceChoice model object.

...

Additional arguments (currently ignored).

Details

The returned matrix can be passed directly to loo or waic for model comparison.

Value

An S \times N matrix of pointwise log-likelihood draws (Stan), or NULL (EM / iStEM).

Methods (by class)

  • get.log_lik(default): Default method; returns object$log_lik when present and NULL otherwise.

Examples


# stan code, long time
sim <- sim.data.MIRT(N = 20, I = 6, D = 2, model = "2PL")
fit <- fit.MIRT(sim$response, model = "2PL", D = 2, method = "stan")
log_lik <- get.log_lik(fit)
loo::loo(log_lik)
loo::waic(log_lik)


ForceChoice documentation built on Sept. 13, 2026, 1:06 a.m.