flag_model_residual | R Documentation |
The functions listed on this help page (flag_*
) allow to flag/identify
potentially problematic model fits. The function were designed to be used
with the models estimating an injection-order-dependent signal drift seen
in LC-MS based untargeted metabolomics data. Such models can be fit with the
rowFitModel
function of the xcms
package. Functions are expected to
return TRUE
for potentially problematic model fits and FALSE
otherwise.
The functions are:
flag_model_residual
: test whether the difference between the difference
between the 25 and 75% quantile of residuals is larger than the user
defined value diff_residual
. This function identifies model fits with
on average large deviations of the individual data points from the fitted
line.
flag_model_mean_residual
: tests if the mean
of the absolute residuals
is larger than the provided value.
flag_model_inj_range
: tests if values on which the model was fitted
spans a minimum required injection index range. This requires x
being
a model of the type y ~ inj_idx
.
flag_model_cat_count
: tests if the number of replicated measurents
(categories) for a categorical variable (e.g. batch) are larger than
min_count
.
flag_model_coef_count
: tests if the number of estimated coefficients
matches the expected number. This is useful/required for linear models
aimed to adjust a batch effect, but for which a coefficient was not
estimated for each batch (=level of the categorical variable representing
the batch). This could happen if only missing values were present for the
respective batch.
flag_model_residual(x, diff_residual = 1) flag_model_mean_residual(x, cut_off = 0.5) flag_model_inj_range(x, min_range = 1, column = "inj_idx") flag_model_cat_count(x, variable, min_count = 4) flag_model_coef_count(x, n_coef)
x |
a linear model object such as generated by |
diff_residual |
for |
cut_off |
for |
min_range |
for |
column |
for |
variable |
for |
min_count |
for |
n_coef |
for |
logical(1)
: TRUE
if model fit is potentially problematic and
FALSE
otherwise or NA
if no model provided.
Johannes Rainer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.