Description Usage Arguments Details Value See Also Examples
View source: R/drift_correction.R
Corrects the drift in the features by applying smoothed cubic spline regression to each feature separately.
1 2 | dc_cubic_spline(object, log_transform = TRUE, spar = NULL,
spar_lower = 0.5, spar_upper = 1.5)
|
object |
a MetaboSet object |
log_transform |
logical, should drift correction be done on log-transformed values? See Details |
spar |
smoothing parameter |
spar_lower, spar_upper |
lower and upper limits for the smoothing parameter |
If log_transform = TRUE
, the correction will be done on log-transformed values.
The correction formula depends on whether the correction is run on original values or log-transformed values.
In log-space: corrected = original + mean of QCs - prediction by cubic spline.
In original space: corrected = original * prediction for first QC / prediction for current point.
We recommend doing the correction in the log-space since the log-transfomred data better follows the
assumptions of cubic spline regression. The drift correction in the original space also sometimes results
in negative values, and results in rejection of the drift corrrection procedure.
If spar
is set to NULL
(the default), the smoothing parameter will
be separately chosen for each feature from the range [spar_lower, spar_upper
]
using cross validation.
list with object = MetaboSet object as the one supplied, with drift corrected features and predicted = matrix of the predicted values by the cubic spline (used in visualization)
smooth.spline
for details about the regression,
inspect_dc
for analysing the drift correction results,
save_dc_plots
for plotting the drift correction process for each feature
1 2 | dc <- dc_cubic_spline(merged_sample)
corrected <- dc$object
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.