Fit a varying-coefficient mixture-of-experts model
Arguments
- formula
A formula of the form
y ~ expert_terms | gating_terms. For grouped binomial data, usecbind(success, failure) ~ expert_terms | gating_terms. For Negative-Binomial count data, expert-sideoffset(log_size_factor)terms are supported.- data
A data frame.
- u
Continuous index column name or numeric vector.
- k
Number of mixture components.
k = 2is the primary v0 target;k = 3:10are high-k candidate support and require diagnostics before being treated as stable.- family
Model family.
"gaussian","binomial", and"negative-binomial"are implemented.- bandwidth
Kernel bandwidth. If
NULL, a Silverman-style default is used foru.- u_grid
Grid where coefficient functions are estimated.
- control
Named list overriding EM and label-alignment settings.
- label
Label strategy.
"align"uses exact global alignment fork <= 6and sequential assignment with ambiguity margins fork >= 7;"global"requests exact global alignment when feasible and falls back to the same sequential assignment path fork >= 7;"greedy"keeps the older one-step alignment.- parameterization
Estimator convention. The public package uses
"a1_epanechnikov_scaled": Epanechnikov density weightsK((u-u0)/h)/hand the scaled local-linear basis(u-u0)/h.- u_scale
How to transform
ubefore fitting. The default"unit"maps complete-rowuvalues to[0, 1];"none"leavesuon the supplied scale.bandwidthandu_gridare interpreted on the transformed analysis scale.- engine
Fitting engine. The default
"local_grid_em"preserves the original independent local-grid EM path."joint_path_em"updates a shared observation-level responsibility path across grid points.- progress
Joint-path progress reporting. The default
NULLis silent; useTRUEfor messages or a single CSV file path for structured logging. Iteration frequency is controlled bycontrol$progress_every.
Details
Rows with missing or non-finite response, covariates, or u are
removed consistently before fitting, with a warning. For single-trial
Bernoulli responses, the default gating ridge is strengthened to
control$ridge = 1 unless the user explicitly supplies control$ridge;
grouped Binomial and other families keep the global default. Joint-path
traces record the sample-level nearest-grid log-likelihood as a diagnostic
criterion. The label-consistent updates do not guarantee that this
diagnostic is monotone; convergence is based on posterior and parameter
deltas instead.