relError_dataset {ratios} | R Documentation |
relError_dataset
Description
The function calculates for each observation for every variable 'vars' in 'Data' the relative error by median absolute deviation (mad
) and median (median
):
\delta Data[vars_{i}] = \frac{mad(Data[vars_{i}], na.rm = T)}{median(Data[vars_{i}], na.rm = T)}
The observations (e.g. samples) are subset into groups by the column group1.vars
.
The relative error is calculated by 'Data' if there are more than 'minNr' entries for each subset of observations.
If there are less observations than 'minNr' for a group in 'Data' than the relative error will be calculated by a replacement data set 'STD',
e.g. you could use a data set of standard reference samples measured at the same machine as your samples.
If you would like to calculate the relative error of all observations in 'Data' set group1.vars
to the column of your sample ID (column with unique entries) and set minNr = 1.
Usage
relError_dataset(Data, vars, group1.vars, group2.vars = NULL, minNr = 7,
STD)
Arguments
Data |
a data.frame or matrix with samples (observations) as rows. |
vars |
optional, character vector of variables of 'Data' for which the error should be calculated.
If left empty the function |
group1.vars |
character vector of variables in 'Data' for splitting 'Data' into subsets. Error will be calculated for each subset. |
group2.vars |
optional, if a variable name of 'Data' is given here a second splitting by |
minNr |
minimum numbers of samples/observations for calculating a relative error of observations.
If the number of samples of |
STD |
data set for calculating the relative errors if in |
Value
data.frame or data.table with relative errors for each observation of 'Data'.
Author(s)
Solveig Pospiech
See Also
Other sub functions: check_readline
,
select.VarsElements