GitHub

R client for MIDAS2 multiple imputation using denoising autoencoders.

rMIDAS2 communicates with a local Python API server over HTTP, so no reticulate dependency is needed at runtime. The package provides functions to fit MIDAS models, generate multiply-imputed datasets, compute imputation means, and run Rubin's rules regression.

Installation

Install from CRAN:

install.packages("rMIDAS2")

Or install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("MIDASverse/MIDAS2", subdir = "rMIDAS2")

Python backend setup

library(rMIDAS2)
install_backend()

Or install manually:

pip install "midasverse-midas-api"

Quick start

library(rMIDAS2)
# Create data with missing values
set.seed(42)
df <- data.frame(
  Y  = rnorm(500),
  X1 = rnorm(500),
  X2 = rnorm(500)
)
df$X1[sample(500, 50)] <- NA
# All-in-one imputation
result <- midas(df, m = 5, epochs = 20)
# View first imputation
head(result$imputations[[1]])
# Mean imputation
mean_df <- imp_mean(result$model_id)
# Rubin's rules regression
reg <- combine(result$model_id, y = "Y")
reg
# Stop the server when finished
stop_server()

License

MIT

Read the original on github.com ↗