View source: R/imput_miss_val.R
impute_missing_val  R Documentation 
Impute the missing entries of a matrix with missing values using different algorithms. See Details section for more details
impute_missing_val( .data, naxis = 1, algorithm = "EMSVD", tol = 1e10, max_iter = 1000, simplified = FALSE, verbose = TRUE )
.data 
A matrix to impute the missing entries. Frequently a twoway 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 
EMAMMI
algorithm
The EMAMMI
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 prefilled 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. If RMSE_p > tol
, the
steps 2 through 5 are repeated. Declare convergence if RMSE_p < tol
.
If max_iter
is achieved without convergence, the algorithm will stop
with a warning.
EMSVD
algorithm
The EMSVD
algorithm impute the missing entries using a lowrank Singular
Value Decomposition approximation estimated by the ExpectationMaximization
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 matrix
Replace 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. If RMSE_p > tol
, the
steps 2 through 3 are repeated. Declare convergence if RMSE_p < tol
.
If max_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.
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.
Gauch, H. G., & Zobel, R. W. (1990). Imputing missing yield trial data. Theoretical and Applied Genetics, 79(6), 753761. 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), 520525.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.