Learn R Programming

DLMRMV (version 1.0.0)

fiMI: fiMI: Predict Missing Response Variables using Multiple Imputation

Description

This function predicts missing response variables in a linear regression dataset using multiple imputation. It leverages the FimIMI function to perform multiple runs of improved multiple imputation and averages the regression coefficients to predict the missing response values.

Usage

fiMI(data, R, n, M)

Value

A list containing:

Yhat

Predicted response values with missing values imputed.

Arguments

data

data.frame containing the linear regression model dataset with missing response variables.

R

Number of runs for multiple imputation.

n

Number of rows in the dataset.

M

Number of multiple imputations per run.

Details

This function assumes that the first column of data is the response variable and the remaining columns are the independent variables. The function uses the FimIMI function to perform multiple runs of improved multiple imputation and averages the regression coefficients to predict the missing response values.

Examples

Run this code
# Example data
set.seed(123)
n <- 1000  # Number of rows
p <- 5  # Number of independent variables
data <- data.frame(Y = rnorm(n), X1 = rnorm(n), X2 = rnorm(n))
data[sample(n, 100), 1] <- NA  # Introduce missing response values

# Call fiMI function
result <- fiMI(data, R = 10, n = n, M = 20)

# View results
print(result$Yhat)  # Predicted response values

Run the code above in your browser using DataLab