HeatBath: Heat-bath sampling of binary states

View source: R/eval.R

HeatBathR Documentation

Heat-bath sampling of binary states

Description

Generates samples of binary state vectors using heat-bath updates under an extended maximum pairwise entropy model parameterized by implicit environmental parameters h and interaction matrix J. Optionally includes environmental effects g, in which case an environmental matrix is generated internally.

Usage

HeatBath(steps, nproc, h, J, g = NULL)

Arguments

steps

Integer. Number of heat-bath iterations to run.

nproc

Integer. Number of parallel samples (rows) to maintain.

h

Numeric vector of length nn, implicit environmental parameters.

J

Numeric matrix of size nn x nn, interaction matrix.

g

Optional numeric matrix of size nn x ne, environmental coefficients.

Value

A list with components:

y

Numeric matrix (nproc x nn) of sampled states (0/1).

enmat

Numeric matrix (nproc x ne) of environmental values, or NULL if g is NULL.

Examples

set.seed(1)
nn <- 5
pars <- hb.paramgen(nn)
res <- HeatBath(steps = 10, nproc = 8, h = pars[[1]], J = pars[[2]])
str(res)


ELAplus documentation built on May 28, 2026, 5:09 p.m.