View source: R/sufficient_stats.R
| compute_sufficient_stats | R Documentation |
Computes the six-component summary that fully encodes one node's contribution to the normal linear VCMM likelihood. These statistics are additive across nodes and batches, so a central server can recover the full-data estimator by summing per-node summaries – without ever seeing the raw response or design matrices.
compute_sufficient_stats(y, X, Z, use_cpp = TRUE)
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. |
use_cpp |
Logical. If |
The returned components are:
a: sum(y^2), a scalar.
b: crossprod(X, y), dimension p by 1.
C: crossprod(X), dimension p by p.
ZtZ: crossprod(Z), dimension q by q.
Zty: crossprod(Z, y), dimension q by 1.
XtZ: crossprod(X, Z), dimension p by q.
Since Day 16 the default backend is a RcppArmadillo implementation
(use_cpp = TRUE). Pass use_cpp = FALSE to fall back to
the pure-R reference path; this is used by the Day-16 bit-equivalence
validation and is also useful for debugging.
A list of class "vcmm_ss" with elements a, b,
C, ZtZ, Zty, XtZ, and n_obs (the
number of observations summarized).
Jalili, L. and Lin, L.-H. (2025). Scalable and Communication-Efficient Varying Coefficient Mixed-Effects Models.
Other sufficient statistics:
accumulate_stats(),
init_accumulator()
set.seed(1)
n <- 100; p <- 3; q <- 2
X <- cbind(1, matrix(rnorm(n * (p - 1)), n, p - 1))
Z <- matrix(rnorm(n * q), n, q)
y <- rnorm(n)
ss <- compute_sufficient_stats(y, X, Z)
str(ss)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.