impute_missing_val {metan} | R Documentation |
Missing value imputation
Description
Impute the missing entries of a matrix with missing values using different algorithms. See Details section for more details
Usage
impute_missing_val(
.data,
naxis = 1,
algorithm = "EM-SVD",
tol = 1e-10,
max_iter = 1000,
simplified = FALSE,
verbose = TRUE
)
Arguments
.data |
A matrix to impute the missing entries. Frequently a two-way table of genotype means in each environment. |
naxis |
The rank of the Singular Value Approximation. Defaults to |
algorithm |
The algorithm to impute missing values. Defaults to
|
tol |
The convergence tolerance for the algorithm. |
max_iter |
The maximum number of steps to take. If |
simplified |
Valid argument when |
verbose |
Logical argument. If |
Details
EM-AMMI
algorithm
The EM-AMMI
algorithm completes a data set with missing values according to both
main and interaction effects. The algorithm works as follows (Gauch and
Zobel, 1990):
The initial values are calculated as the grand mean increased by main effects of rows and main effects of columns. That way, the matrix of observations is pre-filled in.
The parameters of the AMMI model are estimated.
The adjusted means are calculated based on the AMMI model with
naxis
principal components.The missing cells are filled with the adjusted means.
The root mean square error of the predicted values (
RMSE_p
) is calculated with the two lasts iteration steps. IfRMSE_p > tol
, the steps 2 through 5 are repeated. Declare convergence ifRMSE_p < tol
. Ifmax_iter
is achieved without convergence, the algorithm will stop with a warning.
EM-SVD
algorithm
The EM-SVD
algorithm impute the missing entries using a low-rank Singular
Value Decomposition approximation estimated by the Expectation-Maximization
algorithm. The algorithm works as follows (Troyanskaya et al., 2001).
Initialize all
NA
values to the column means.Compute the first
naxis
terms of the SVD of the completed matrixReplace the previously missing values with their approximations from the SVD
The root mean square error of the predicted values (
RMSE_p
) is calculated with the two lasts iteration steps. IfRMSE_p > tol
, the steps 2 through 3 are repeated. Declare convergence ifRMSE_p < tol
. Ifmax_iter
is achieved without convergence, the algorithm will stop with a warning.
colmeans
algorithm
The colmeans
algorithm simply impute the missing entires using the
column mean of the respective entire. Thus, there is no iteractive process.
Value
An object of class imv
with the following values:
-
.data The imputed matrix
-
pc_ss The sum of squares representing variation explained by the principal components
-
iter The final number of iterations.
-
Final_RMSE The maximum change of the estimated values for missing cells in the last step of iteration.
-
final_axis The final number of principal component axis.
-
convergence Logical value indicating whether the modern converged.
References
Gauch, H. G., & Zobel, R. W. (1990). Imputing missing yield trial data. Theoretical and Applied Genetics, 79(6), 753-761. doi:10.1007/BF00224240
Troyanskaya, O., Cantor, M., Sherlock, G., Brown, P., Hastie, T., Tibshirani, R., . Altman, R. B. (2001). Missing value estimation methods for DNA microarrays. Bioinformatics, 17(6), 520-525.
Examples
library(metan)
mat <- (1:20) %*% t(1:10)
mat
# 10% of missing values at random
miss_mat <- random_na(mat, prop = 10)
miss_mat
mod <- impute_missing_val(miss_mat)
mod$.data