Skip to main content

rcompat_locfit/
lib.rs

1//! Clean-room Rust implementation of selected R `locfit`-compatible local
2//! regression behavior.
3//!
4//! This crate currently focuses on the one-dimensional local polynomial path
5//! needed for DESeq2-style local dispersion trend fitting. It does not bind to
6//! R, does not call R at runtime, and does not contain R `locfit` source code.
7//! The DESeq2-oriented path is fixture-validated against black-box R `locfit`;
8//! broader exact R `locfit` parity is still in progress.
9//!
10//! # Example
11//!
12//! ```
13//! use rcompat_locfit::fit_deseq2_local_dispersion_trend;
14//!
15//! let means = [1.0, 2.0, 5.0, 10.0, 100.0, 1000.0];
16//! let disps = [0.5, 0.3, 0.2, 0.12, 0.06, 0.03];
17//!
18//! let trend = fit_deseq2_local_dispersion_trend(&means, &disps, 1e-8)?;
19//! let prediction = trend.predict_one(30.0)?;
20//! assert!(prediction.is_finite() && prediction > 0.0);
21//! # Ok::<(), rcompat_locfit::LocfitError>(())
22//! ```
23
24pub mod config;
25pub mod deseq2;
26pub mod error;
27pub mod kernel;
28pub mod local_fit;
29pub mod wls;
30
31pub use config::{Kernel, LocalRegressionConfig, PredictionMethod};
32pub use deseq2::{
33    fit_deseq2_local_dispersion_trend, fit_deseq2_local_dispersion_trend_from_logs,
34    Deseq2LocalDispersionTrend,
35};
36pub use error::LocfitError;
37pub use local_fit::LocalFit;