DCSLMI: Distributed and Consensus-Based Stochastic Linear Multiple...

View source: R/DCSLMI.R

DCSLMIR Documentation

Distributed and Consensus-Based Stochastic Linear Multiple Imputation (DCSLMI)

Description

Performs multiple imputation for missing response variables in linear regression models. This method iteratively updates parameter estimates using ordinary least squares (OLS) and generates M complete datasets by imputing missing values with different parameter draws.

Usage

DCSLMI(data, R = 1000, M = 20)

Arguments

data

A data frame or matrix. The first column contains the response variable 'y' (which may include NA values), and the remaining columns are predictors 'X'.

R

Number of internal iterations for parameter estimation per imputation.

M

Number of multiple imputations to generate.

Value

A list containing:

Yhat

A matrix of size n x M, where each column is a completed response vector.

betahat

A matrix of size (p+1) x M, where each column contains the estimated regression coefficients.

missing_count

The number of missing values in the original response variable.

Examples

# Simulate data with missing responses
set.seed(123)
data <- data.frame(
  y = c(rnorm(50), rep(NA, 10)),
  x1 = rnorm(60),
  x2 = rnorm(60)
)

# Perform multiple imputation
result <- DCSLMI(data, R = 500, M = 10)

# View imputed response values
head(result$Yhat)

# View coefficient estimates
apply(result$betahat, 1, mean)  # average estimates
apply(result$betahat, 1, sd)    # uncertainty across imputations


DLMRMV documentation built on Aug. 8, 2025, 6:27 p.m.

Related to DCSLMI in DLMRMV...