space: Fit a matrix-variate SPACE sparse partial correlation model

View source: R/matSPACE.R

spaceR Documentation

Fit a matrix-variate SPACE sparse partial correlation model

Description

Estimates a sparse network of partial correlations among the q columns of matrix-variate data using an L1-penalized (lasso) SPACE-style shooting algorithm, with optional per-column reweighting and residual variance (sig) re-estimation across outer iterations.

Usage

space(
  data,
  lam,
  sig = NULL,
  f_type = "equal",
  iter = 2,
  beta_init = NULL,
  sig_init = NULL
)

Arguments

data

list of n matrices, each p × q. All matrices share the same p × q shape; n is the number of independent replicates and the q columns are the variables whose pairwise partial correlations are estimated.

lam

lasso penalty applied to the off-diagonal partial correlation coefficients.

sig

optional length-q sigma vector; NULL = iterative estimate

f_type

"equal" | "variance" | "degree"

iter

number of outer iterations

beta_init

optional warm-start for beta: a q x q matrix/flat vector (row-major, i*q+j layout) forwarded to the first internal space_shooting() call instead of the default univariate soft-threshold initialization. Only meaningful for the first outer iteration, since that is the only one whose sigma_sr (sqrt(SIG/WEIGHT)) does not depend on lam — the first pass always starts from SIG = rep(1, q), WEIGHT = rep(1, q) regardless of lam, so a beta fit at a neighboring lambda is a valid warm start there. Requires the compiled space_shooting() routine in src/matSPACE.cpp, which accepts a beta_init argument.

sig_init

optional length-q warm-start for the STARTING value of SIG when SIG.update = TRUE (i.e. sig = NULL). Unlike sig, this does not pin SIG constant — it is still re-estimated every outer iteration via estimate_sigma(); it only replaces the rep(1, q) cold start at i = 1 with a neighboring lambda's converged SIG, so f_type = "variance"/"degree" don't force a uniform-weight first pass before ever seeing a realistic weighting.

Value

A list with components:

ParCor

q x q matrix of estimated partial correlations (diagonal = 1).

beta

q x q matrix of estimated regression coefficients.

sig

length-q vector of estimated column residual precisions (1/variance).

f

length-q vector of final per-column weights.

total_iter

total number of shooting iterations across all outer iterations.

E

list of n residual matrices (p x q each).

Examples

set.seed(1)
p <- 5; q <- 4; n <- 3
data <- replicate(n, matrix(rnorm(p * q), p, q), simplify = FALSE)
fit <- space(data, lam = 0.1, iter = 1)
fit$ParCor

matSPACE documentation built on Sept. 12, 2026, 5:10 p.m.