View source: R/mv_imputation.R
mv_imputation | R Documentation |
Missing values in metabolomics data sets occur widely and can originate from
a number of sources, including technical and biological reasons.
Missing values imputation is applied to replace non-existing values
with an estimated values while maintaining the data structure. A number of
different methods are available as part of this function.
mv_imputation(
df,
method,
k = 10,
rowmax = 0.5,
colmax = 0.5,
maxp = NULL,
check_df = TRUE
)
df |
A matrix-like (e.g. an ordinary matrix, a data frame) or
RangedSummarizedExperiment-class object with
all values of class |
method |
|
k |
|
rowmax |
|
colmax |
|
maxp |
|
check_df |
|
Supported missing value imputation methods are:
knn
- K-nearest neighbour. For each feature in each sample, missing
values are replaced by the mean average value (non-weighted) calculated
from its k
closest neighbours in multivariate space (default distance
metric: euclidean distance);
rf
- Random Forest. This method is a wrapper of
missForest function. For each feature, missing values are
iteratively imputed until a maximum number of iterations (10), or until the
difference between consecutively-imputed matrices becomes positive.
Trees per forest are set to 100, variables included per tree are calculate
using formula sqrt(total number of variables)
;
bpca
- Bayesian principal component analysis. This method is a
wrapper of pca function. Missing values are replaced by
the values obtained from principal component analysis regression with a
Bayesian method. Therefore every imputed missing value does not occur
multiple times, neither across the samples nor across the metabolite
features;
sv
- Small value. For each feature, replace missing values with half
of the lowest value recorded in the entire data matrix;
'mn'
- Mean. For each feature, replace missing values with the mean
average (non-weighted) of all other non-missing values for that variable;
'md'
- Median. For each feature, replace missing values with the
median of all other non-missing values for that variable.
Object of class SummarizedExperiment
. If input data are a
matrix-like (e.g. an ordinary matrix, a data frame) object, function returns
the same R data structure as input with all value of data type
numeric()
.
df <- MTBLS79[ ,MTBLS79$Batch == 1]
out <- mv_imputation(df=df, method='knn')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.