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.
Install the released version from CRAN:
install.packages("VCMoE")
Install the development version from GitHub:
install.packages("remotes")
# remotes::install_github("qc-zhao/VCMoE")
install.packages("VCMoE", repos = c('https://qc-zhao.r-universe.dev', 'https://cloud.r-project.org'))
Load the package:
library(VCMoE)
Need help with installation or usage? Please open a GitHub issue:
https://github.com/qc-zhao/VCMoE/issues
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)
The full documentation website includes Gaussian, Binomial, and Negative-Binomial tutorials plus the function reference:
https://qc-zhao.github.io/VCMoE/
Useful links:
Please cite:
Zhao Q, Greenwood CMT, Zhang Q. Varying-Coefficient Mixture of Experts Model. arXiv:2601.01699. https://arxiv.org/abs/2601.01699