node_summary: Compute one node's sufficient-statistics summary

View source: R/distributed.R

node_summaryR Documentation

Compute one node's sufficient-statistics summary

Description

Convenience alias for compute_sufficient_stats, intended for distributed-computing workflows. Each compute node calls this on its local data and transmits the small returned summary; the central server aggregates summaries with + (or Reduce("+", summaries)) and fits via fit_from_summaries.

Usage

node_summary(y, X, Z)

Arguments

y

Numeric response vector of length n.

X

Numeric n by p fixed-effects design matrix (intercept plus spline basis columns).

Z

Numeric n by q random-effects design matrix.

Details

What's transmitted. The returned object contains six fixed-size arrays whose dimensions depend only on p = \mathrm{ncol}(X) and q = \mathrm{ncol}(Z), never on the node-local sample size. For a typical VCMM with p \approx 15 and q \approx 50, one summary is a few kilobytes regardless of N_s.

Basis alignment. All nodes must build their local X (the spline-expanded fixed-effects design) using the same basis specification. The recommended workflow is to call build_vcmm_design once with the full t-range (or pre-agreed knots), broadcast the resulting basis, and have each node evaluate it on local t. The package itself does not enforce this; mis-aligned bases will silently give incorrect fits.

Value

A vcmm_ss object (additive via +.vcmm_ss).

References

Jalili, L. and Lin, L.-H. (2025). Scalable and Communication-Efficient Varying Coefficient Mixed-Effects Models.

See Also

fit_from_summaries, compute_sufficient_stats, build_vcmm_design

Examples

set.seed(1)
n_per_node <- 100; p <- 5; q <- 3
X <- cbind(1, matrix(rnorm(n_per_node * (p - 1)), n_per_node, p - 1))
Z <- matrix(rnorm(n_per_node * q), n_per_node, q)
y <- rnorm(n_per_node)

gamma_1 <- node_summary(y, X, Z)
gamma_2 <- node_summary(y, X, Z)
gamma_pooled <- gamma_1 + gamma_2
gamma_pooled

cevcmm documentation built on July 24, 2026, 5:07 p.m.