knitr::opts_chunk$set( fig.width = 8, fig.height = 6, fig.align = "center", collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE )
Outliers can strongly influence precision profiles, especially when only a small number of concentration levels is available. The outlier detection workflow in VFP is intended as a diagnostic aid. A detected outlier should not be removed automatically; the analytical context and available experimental information should be reviewed before deciding whether to exclude an observation.
The Glucose data set contains duplicate measurements. For this example, the
mean concentration and variance are calculated from each duplicate pair. Because
each variance is derived from two measurements, the corresponding degrees of
freedom are set to one.
suppressPackageStartupMessages(library(VFP)) glucose <- Glucose glucose$DF <- 1 glucose$Mean <- (glucose$V1 + glucose$V2) / 2 glucose$VC <- (glucose$V1 - glucose$V2)^2 / 4 glucose <- glucose[glucose$VC > 0, ] head(glucose[, c("Mean", "VC", "DF")])
First, fit the candidate precision profile models to all observations.
fit <- fit_vfp(glucose, model.no = 1:9, quiet = TRUE) plot(fit, type = "cv")
The initial fit represents the precision profile using all observations. If one observation has a large influence on the selected model or on the fitted curve, this may become visible in the profile or in the model diagnostics.
out <- find_outliers(fit, mult = "fdr") out$outliers$res[, c("SampleID", "OCmean", "OCvar", "OCcv", "pValue", "Outlier")]
Here, mult = "fdr" uses false discovery rate adjustment. See the section
"Notes on Multiplicity Adjustment" for available options.
find_outliers() ranks candidate observations using deviance residuals and
evaluates whether removing a candidate improves the model fit. The procedure
refits the model iteratively and can adjust p-values for multiple testing.
plot_outliers(out, type = "cv")
The outlier plot compares the original fit with the final fit after removal of confirmed outliers.
The result should be interpreted as statistical evidence for influential observations, not as an automatic exclusion rule. Before removing an observation, review whether there is an analytical, technical, or documentation-based reason for exclusion.
A recommended workflow is:
find_outliers().plot_outliers().The mult argument controls how p-values are adjusted for multiple testing.
Available options are:
"fdr": false discovery rate adjustment; a pragmatic default for routine use"bonf": Bonferroni adjustment; a more conservative family-wise error rate
adjustment"none": no multiplicity adjustmentFor most routine applications, "fdr" is a reasonable starting point because it
balances sensitivity and control of false discoveries. Use "bonf" when false
positive outlier calls should be minimized, and "none" mainly for exploratory
analyses or debugging.
Outlier detection is most useful as a diagnostic tool. Results can be unstable for very small data sets, highly sparse concentration ranges, or cases where several observations jointly influence the model. The procedure should therefore support, not replace, scientific judgment.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.