SVDImpute {DTSR} | R Documentation |
Improved SVD Imputation
Description
This function performs imputation using Singular Value Decomposition (SVD) with iterative refinement. It begins by filling missing values with the mean of their respective columns. Then, it computes a low-rank (k) approximation of the data matrix. Using this approximation, it refills the missing values. This process of recomputing the rank-k approximation with the newly imputed values and refilling the missing data is repeated for a specified number of iterations, 'num.iters'.
Usage
SVDImpute(x, k, num.iters = 10, verbose = TRUE)
Arguments
x |
A data frame or matrix where each row represents a different record. |
k |
The rank-k approximation to use for the data matrix. |
num.iters |
The number of times to compute the rank-k approximation and impute the missing data. |
verbose |
If TRUE, print status updates during the process. |
Value
A list containing:
data.matrix |
The imputed matrix with missing values filled. |
Examples
# Create a sample matrix with random values and introduce missing values
x = matrix(rnorm(100), 10, 10)
x[x > 1] = NA
# Perform SVD imputation
imputed_x = SVDImpute(x, 3)
# Print the imputed matrix
print(imputed_x)