Runs EM iterations for coordinate-specific SmoothEM (csmooth_em). Supports adaptive updates of the coordinate-wise smoothing parameters \(\lambda_j\).

When adaptive = "ml", this function dispatches to do_csmoothEM_ml_collapsed (collapsed-ML variant). In that case, sigma_update controls whether \(\sigma^2\) is updated via the standard M-step or via collapsed-ML optimization.

do_csmoothEM(
  object,
  data = NULL,
  iter = 1,
  record = TRUE,
  adaptive = NULL,
  lambda_min = NULL,
  lambda_max = NULL,
  sigma_update = c("mstep", "ml"),
  sigma_min = 1e-10,
  sigma_max = 1e+10,
  verbose = FALSE
)

Arguments

object

A csmooth_em object.

data

Optional n-by-d data matrix. If NULL, uses object$data.

iter

Integer \(\ge 1\); number of EM iterations to run.

record

Logical; if TRUE, record traces.

adaptive

Adaptive option controlling \(\lambda\) updates:

NULL

Inherit object$control$adaptive.

"none"

No adaptive update (fixed lambda_vec).

"prior"

Prior-based update for \(\lambda_j\) using the current M-step \(\mu\).

"ml"

Collapsed-ML update for \(\lambda_j\) (dispatches to do_csmoothEM_ml_collapsed).

A logical value is accepted for backward compatibility: TRUE is treated as "prior" and FALSE as "none".

lambda_min, lambda_max

Positive bounds used for adaptive \(\lambda\) updates.

sigma_update

Character. Only used when adaptive="ml" (i.e., in the collapsed-ML path). Either "mstep" or "ml"; see do_csmoothEM_ml_collapsed.

sigma_min, sigma_max

Positive bounds for sigma2 when adaptive="ml" and sigma_update="ml".

verbose

Logical; if TRUE, print a short progress line each iteration.

Value

Updated csmooth_em object.