VCMoE

R License: MIT Documentation arXiv Issues welcome

Varying-Coefficient Mixture-of-Experts Models

VCMoE is an R package for fitting varying-coefficient mixture-of-experts models. It supports Gaussian, Binomial, and Negative-Binomial responses, with local-linear estimation, component label alignment, bandwidth selection, diagnostics, confidence bands, bootstrap inference, and generalized likelihood-ratio tests.

The package is intended for problems where component-specific response relationships and component probabilities change along a continuous coordinate, such as time, pseudotime, dose, or spatial location.

Installation

Install the package from GitHub:

install.packages("remotes")
remotes::install_github("qc-zhao/VCMoE")

Load the package:

library(VCMoE)

Need help with installation or usage? Please open a GitHub issue:

https://github.com/qc-zhao/VCMoE/issues

Quick Start

set.seed(1)

sim <- simulate_vcmoe_gaussian(
  n = 300,
  k = 2,
  scenario = "well_separated"
)

fit <- vcmoe_fit(
  y ~ z1 | x1,
  data = sim$data,
  u = sim$data$u,
  k = 2,
  family = "gaussian",
  bandwidth = 0.25
)

coef(fit, "expert")
predict(fit, type = "posterior")
plot_coefficients(fit)

Documentation

The full documentation website includes a Gaussian simulation tutorial and function reference:

https://qc-zhao.github.io/VCMoE/

Useful links:

Citation

Please cite:

Zhao Q, Greenwood CMT, Zhang Q. Varying-Coefficient Mixture of Experts Model. arXiv:2601.01699. https://arxiv.org/abs/2601.01699