Skip to main content

Crate solow_impute

Crate solow_impute 

Source
Expand description

§solow-impute

The deterministic core of multiple imputation by chained equations (MICE).

Multiple imputation has two ingredients: a stochastic step that draws plausible replacements for missing values, and a deterministic step that combines the analyses of the completed data sets back into a single inference. This crate implements the deterministic pieces, which are exactly reproducible and can be validated against an authoritative reference:

  • combine applies Rubin’s combining rules to per-imputation parameter estimates and covariance matrices, returning the pooled estimate, the within/between/total covariance, the fraction of missing information, and the Barnard–Rubin degrees of freedom.
  • conditional_mean_impute performs a single deterministic conditional-mean (regression) imputation of one variable given the others.

The stochastic posterior draws that drive a full MICE run depend on a random number generator and are intentionally out of scope here.

use ndarray::array;
use solow_impute::combine;

let p1 = array![1.0, 2.0];
let p2 = array![1.2, 1.8];
let c1 = array![[0.04, 0.0], [0.0, 0.05]];
let c2 = array![[0.05, 0.0], [0.0, 0.06]];
let res = combine(&[p1, p2], &[c1, c2], f64::INFINITY).unwrap();
assert!((res.params[0] - 1.1).abs() < 1e-12);

Structs§

CombinedEstimate
Pooled multiple-imputation estimate produced by Rubin’s combining rules.
ConditionalMeanImputation
Result of a single deterministic conditional-mean imputation.
IterativeImputer
Fitted IterativeImputer.
KnnImputer
Fitted KNNImputer.
SimpleImputer
Fitted SimpleImputer.

Enums§

SimpleStrategy
Imputation strategy.

Functions§

combine
Combine per-imputation estimates with Rubin’s rules.
conditional_mean_impute
Fit endog_obs ~ exog_obs by ordinary least squares and predict the conditional mean at exog_miss.