Learn R Programming

DLFM (version 0.2.2)

osdr_lfm: Online Sufficient Dimension Reduction for Laplace Factor Models (OSDR-LFM)

Description

Implements an online SIR-based sufficient dimension reduction method tailored for Laplace Factor Models (LFM) with symmetric, asymmetric, or skewed error structures. Supports distributed deployment via local updates and global aggregation.

Usage

osdr_lfm(
  X,
  Y = NULL,
  laplace_type = c("symmetric", "asymmetric", "skewed"),
  K_max = NULL,
  H = NULL,
  method_svd = c("gradient", "perturbation"),
  is_distributed = FALSE,
  node_id = 1,
  sync_interval = 50,
  verbose = FALSE
)

Value

list with B_hat (p x K_est), K_est, lambda_trace, and (if distributed) local_B.

Arguments

X

numeric matrix (n x p), observations in rows.

Y

optional numeric vector (n) of proxy responses (e.g., factor scores). If NULL, uses norm of projection as proxy (unsupervised LFM mode).

laplace_type

character; one of "symmetric", "asymmetric", or "skewed".

K_max

integer; maximum candidate dimension (default = min(10, p)).

H

integer; number of slices for SIR (default = max(5, floor(sqrt(n)))).

method_svd

character; "perturbation" or "gradient" (default = "gradient").

is_distributed

logical; if TRUE, simulate distributed node behavior.

node_id

integer; node identifier (only used if is_distributed = TRUE).

sync_interval

integer; how often to "aggregate" in distributed mode (ignored if not distributed).

verbose

logical; print progress.

Examples

Run this code
set.seed(42)
n <- 600; p <- 30; m <- 4
A <- qr.Q(qr(matrix(rnorm(p * m), p, m)))
F <- matrix(rnorm(n * m), n, m)
eps <- matrix(rexp(n * p) - rexp(n * p), n, p)
X <- F %*% t(A) + eps

out <- osdr_lfm(X, laplace_type = "asymmetric", K_max = 6, verbose = TRUE)
cat("Estimated K:", out$K_est, "\n")

Run the code above in your browser using DataLab