Missing Data Imputation via Language Models and Statistics
Overview
Provides missing data imputation through two complementary engines: a large language model engine that communicates with the 'Anthropic' 'Claude' application programming interface for context-aware semantic imputation, and a fully self-contained offline engine implementing nineteen statistical and machine learning algorithms entirely in base R with no additional package dependencies. Offline methods include mean, median, mode, last observation carried forward, next observation carried backward, hot-deck, predictive mean matching, k-nearest neighbours, ordinary least-squares regression, Lasso with coordinate descent, Ridge with closed-form solution, Bayesian Ridge regression with evidence approximation following MacKay (1992), support vector regression with a radial basis function kernel, classification and regression trees, random forests, gradient boosting, iterative random forest imputation, principal component analysis imputation via iterative singular value decomposition, and nuclear-norm minimisation via singular value thresholding. When no API key is available the package automatically falls back to the offline engine, ensuring full operation in environments without internet access. Every imputed value is accompanied by a confidence score and a plain-language reasoning string, producing reproducible audit trails. The automatic method selector chooses the best algorithm per column based on data type, skewness, missingness rate, and inter-column correlations.
Initial CRAN release
New features
lmi_impute()— unified imputation entry point. Automatically selects between the LLM engine (Anthropic Claude API) and the offline statistical engine based on API key availability.lmi_impute_offline()— fully self-contained imputation using nineteen algorithms implemented in base R. No internet connection or API key required.lmi_diagnose()— local missingness audit: reports missing counts, percentages, and column types without any API calls.lmi_set_api_key()/lmi_get_api_key()— session-scoped API key management viaoptions()or theANTHROPIC_API_KEYenvironment variable.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
lmi_set_model()/lmi_get_model()— select the Anthropic Claude model used for LLM imputation.lmi_export()— write the imputed data frame and audit trail to CSV or RDS files.lmi_methods()— print a formatted catalogue of all available offline imputation methods with usage guidance.- S3 methods
print.lmi_result(),summary.lmi_result(), andas.data.frame.lmi_result()for thelmi_resultclass. - Nineteen offline imputation algorithms:
- Classical: mean, median, mode, LOCF, NOCB, hot-deck, PMM
- Regression: linear, Lasso (coordinate descent), Ridge (closed form), Bayesian Ridge (evidence approximation)
- Kernel/neighbour: KNN (scaled Euclidean), SVR (RBF kernel)
- Tree/ensemble: decision tree (CART), random forest, gradient boosting
- Iterative: MissForest
- Matrix completion: PCA imputation (iterative SVD), SoftImpute (nuclear-norm minimisation)
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK8 OK2026-06-24
Documentation
- Help pages
- 14 (2 internal)includes a package overview page
- Examples that run
- 92%11 run in a plain check · 1 never run
- Exported functions with examples
- 100%
- Documented parameters
- 98%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Dependencies
Installing llmimpute adds 14 packages (10 with compiled code, 6.1 MB of source tarballs). Heaviest: openssl 1.1 MB, jsonlite 1.0 MB, vctrs 1.0 MB.
Code & Tests
People & History
- 0.1.0Latestfirst seen 2026-06-23 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First seen
- 2026-06-23
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 43 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("llmimpute")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.