fiMI | R Documentation |
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.
fiMI(data, R, n, M)
data |
|
R |
Number of runs for multiple imputation. |
n |
Number of rows in the dataset. |
M |
Number of multiple imputations per run. |
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.
A list containing:
Yhat |
Predicted response values with missing values imputed. |
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.