Skip to contents

p(x) = exp(sum theta_j0 x_j + sum over edges theta_jk x_j x_k - Phi) fitted by Newton with exact moments over the 2^p states (ESL eqs 17.28-17.35); the same fit as the Poisson log-linear model of the 2^p table (eq 17.45).

Usage

morie_esl_ising_fit(X, edges, max_iter = 100, tol = 1e-12)

Arguments

X

Binary data, N by p (small p).

edges

Two-column matrix of 1-based node pairs.

max_iter, tol

Newton controls.

Value

Named list: main, edges (pairs with theta), loglik, Phi, iterations, converged.

References

Hastie, Tibshirani & Friedman (2009), sec. 17.4.1.

Examples

t <- 1:200
Xb <- cbind(as.integer(sin(t) > 0), as.integer(sin(t) + cos(3 * t) > 0.2),
  as.integer(cos(2 * t) > 0))
morie_esl_ising_fit(Xb, rbind(c(1, 2), c(2, 3)))$edges
#>              theta
#> [1,] 1 2 3.0218200
#> [2,] 2 3 0.2022103