elbo_functions: ELBO Component Functions

elbo_functionsR Documentation

ELBO Component Functions

Description

Internal functions computing the six additive terms of the Evidence Lower Bound (ELBO), which serves as both the convergence criterion and the M-step objective in the VEM algorithm (da Cruz et al., 2024, eq. 36–42).

The per-curve terms (expectedLogLikelihood, elboInclusionTerm, elboBetaTerm, elboThetaTerm) are summed over i=1,\ldots,m. The global terms (elboSigmaPriorTerm, elboTauTerm) contribute once.

elbo_corr assembles all six terms into the total ELBO at fixed w.

elbo_omega wraps elbo_corr as a function of w alone, passed to optim() as the M-step objective.

dev_elbo provides the analytic gradient \partial\text{ELBO}/\partial w, passed to optim() to enable L-BFGS-B optimisation.

Arguments

y

List of observed curve vectors.

ni

Integer vector of per-curve sample sizes.

B

List of basis matrices.

i

Integer. Curve index (per-curve terms only).

m

Integer. Number of curves.

K

Integer. Number of basis functions.

iter

Integer. Current iteration index.

delta_1, delta_2

Prior hyperparameters for \sigma^2.

lambda_1, lambda_2

Prior hyperparameters for \tau^2.

delta1_q, delta2_values

Shape and scale trajectory of q(\sigma^2).

lambda1_q, lambda2_values

Shape and scale trajectory of q(\tau^2).

mu_beta_values

Matrix of posterior beta mean trajectories.

Sigma_beta

Array of posterior beta covariance matrices.

a1_values, a2_values

Shape parameter trajectories for q(\theta_{ki}).

prob_values

Matrix of inclusion probability trajectories.

mu_ki

Scalar prior hyperparameter for \theta_{ki}.

psi

Current correlation matrix \Psi(w).

w

Positive scalar. Decay parameter (elbo_omega, dev_elbo only).

Xt

Numeric vector of evaluation points (elbo_omega, dev_elbo only).

logdet_psi

Pre-computed \log|\Psi| or NULL (expectedLogLikelihood only).

Value

A numeric scalar.


fda.vi documentation built on June 20, 2026, 5:06 p.m.