tulpa_loglik: Streaming pointwise log-likelihood

View source: R/criteria.R

tulpa_loglikR Documentation

Streaming pointwise log-likelihood

Description

Wrap a pointwise log-likelihood for tulpa_criteria() without materializing the whole ⁠[n_draws x n_obs]⁠ matrix. A plain matrix is wrapped directly; a block generator (a function of an integer column vector returning the ⁠[n_draws x length(cols)]⁠ submatrix) lets the criteria accumulators stream over observation blocks, so an EVA-scale ⁠[200 x 1.16M]⁠ log-likelihood is consumed a few thousand columns at a time.

Usage

tulpa_loglik(x, n_obs = NULL, n_draws = NULL)

Arguments

x

Either a numeric ⁠[n_draws x n_obs]⁠ matrix, an existing tulpa_loglik, or a function f(cols) returning the ⁠[n_draws x length(cols)]⁠ submatrix for the integer column indices cols.

n_obs, n_draws

Required when x is a generator function; the column and row counts of the implied matrix.

Value

A tulpa_loglik object: a list with get(cols), n_obs, n_draws, and materialized.

See Also

tulpa_criteria()

Examples

ll <- tulpa_loglik(matrix(rnorm(20 * 5, -1), nrow = 20))  # 20 draws x 5 obs
c(ll$n_draws, ll$n_obs)

tulpa documentation built on Oct. 19, 2026, 5:09 p.m.