midas: Multiple imputation (all-in-one)

View source: R/client.R

midasR Documentation

Multiple imputation (all-in-one)

Description

Convenience function that fits a MIDAS model and generates imputations in a single call. Equivalent to calling midas_fit() followed by midas_transform().

Usage

midas(
  data,
  m = 5L,
  hidden_layers = c(256L, 128L, 64L),
  dropout_prob = 0.5,
  epochs = 75L,
  batch_size = 64L,
  lr = 0.001,
  corrupt_rate = 0.8,
  num_adj = 1,
  cat_adj = 1,
  bin_adj = 1,
  pos_adj = 1,
  omit_first = FALSE,
  seed = 89L,
  ...
)

Arguments

data

A data frame (may contain NA for missing values).

m

Integer. Number of imputations (default 5).

hidden_layers

Integer vector of hidden layer sizes (default c(256, 128, 64)).

dropout_prob

Numeric. Dropout probability (default 0.5).

epochs

Integer. Number of training epochs (default 75).

batch_size

Integer. Mini-batch size (default 64).

lr

Numeric. Learning rate (default 0.001).

corrupt_rate

Numeric. Corruption rate for denoising (default 0.8).

num_adj

Numeric. Loss multiplier for numeric columns (default 1).

cat_adj

Numeric. Loss multiplier for categorical columns (default 1).

bin_adj

Numeric. Loss multiplier for binary columns (default 1).

pos_adj

Numeric. Loss multiplier for positive columns (default 1).

omit_first

Logical. Omit first column from encoder input (default FALSE).

seed

Integer. Random seed (default 89).

...

Arguments forwarded to ensure_server().

Value

A list with model_id and imputations (a list of data frames).

Examples

## Not run: 
df <- data.frame(X1 = rnorm(200), X2 = rnorm(200))
df$X1[sample(200, 40)] <- NA
result <- midas(df, m = 5, epochs = 10)
head(result$imputations[[1]])

## End(Not run)

rMIDAS2 documentation built on March 12, 2026, 9:07 a.m.