bmdd.nlopt: NLopt C++ Implementation of BMDD

View source: R/bmdd_nlopt.R

bmdd.nloptR Documentation

NLopt C++ Implementation of BMDD

Description

High-performance implementation using NLopt L-BFGS-B optimizer in C++. Provides 50-90x speedup over R implementation for cases without covariates. This is a low-level function; most users should use bmdd() instead.

Usage

bmdd.nlopt(W, type = c("count", "proportion"),
           para.alp.init = NULL, para.pi.init = NULL, gam.init = NULL,
           iterlim = 500, tol = 1e-6, trace = FALSE,
           inner.loop = TRUE, inner.iterlim = 20, inner.tol = 1e-6,
           alp.iterlim = 100, alp.tol = 1e-6,
           alp.min = 1e-3, alp.max = 1e3)

Arguments

W

Matrix of observed data (m taxa × n samples)

type

Data type: "count" or "proportion"

para.alp.init

Initial alpha values

para.pi.init

Initial pi values

gam.init

Initial gamma values

iterlim

Maximum iterations (default 500)

tol

Convergence tolerance (default 1e-6)

trace

Print progress (default FALSE)

inner.loop

Use inner loop optimization (default TRUE)

inner.iterlim

Inner loop max iterations (default 20)

inner.tol

Inner loop tolerance (default 1e-6)

alp.iterlim

Alpha optimization iterations (default 100)

alp.tol

Alpha tolerance (default 1e-6)

alp.min

Minimum alpha (default 1e-3)

alp.max

Maximum alpha (default 1e3)

Details

This function provides direct access to the NLopt C++ implementation. Most users should use bmdd() instead, which automatically selects the optimal implementation.

Does not support covariates. For covariate modeling, use bmdd() with method="R".

Value

A list containing estimated parameters (same as bmdd)

References

Zhou, H., Chen, J., & Zhang, X. (2025). BMDD: A probabilistic framework for accurate imputation of zero-inflated microbiome sequencing data. PLoOS Computational Biology, 21(10), e1013124.

See Also

bmdd for the main user interface

Examples

## Not run: 
# Simulate data
m <- 100
n <- 50
W <- matrix(rpois(m*n, 100), m, n)

# Direct NLopt usage (advanced)
result <- bmdd.nlopt(W, type = "count")

# Recommended: use bmdd() instead
result <- bmdd(W, type = "count")  # auto-selects NLopt

## End(Not run)

MicrobiomeStat documentation built on Jan. 9, 2026, 1:07 a.m.