filterAnchors: Filter Outlier Ordered Pairs

View source: R/fit_model.R

filterAnchorsR Documentation

Filter Outlier Ordered Pairs

Description

Helper function for fit_gam & fit_loess. It filters the set of ordered pairs using the residuals calculated from multiple GAM / loess fits.

Usage

filterAnchors(
  rts,
  fit,
  vals,
  outlier,
  coef,
  iterFilter,
  prop,
  bs,
  m,
  family,
  method,
  optimizer,
  control,
  message,
  ...
)

Arguments

rts

Data frame of ordered retention time pairs.

fit

Either "gam" for GAM fits, or "loess" for loess fits

vals

numeric values: k values for GAM fits, spans for loess fits

outlier

Thresholding method for outlier dection. If "MAD", the threshold is the mean absolute deviation (MAD) times coef; if "boxplot", the threshold is coef times IQR plus 3rd quartile of a model's absolute residual values.

coef

numeric (> 1) multiplier for determining thresholds for outliers (see outlier argument)

iterFilter

integer number of outlier filtering iterations

prop

numeric. A point is excluded if deemed a residual in more than this proportion of fits. Must be between 0 & 1.

bs

character. Choice of spline method from mgcv; either "bs" or "ps"

m

integer. Basis and penalty order for GAM; see ?mgcv::s

family

character. Choice of mgcv family; see: ?mgcv::family.mgcv

method

character. Smoothing parameter estimation method; see: ?mgcv::gam

optimizer

character. Method to optimize smoothing parameter; see: ?mgcv::gam

control

control parameters for loess fits; see: ?loess.control

message

Option to print message indicating function progress

...

other arguments passed to mgcv::gam.

Value

anchor rts data frame with updated weights.


hhabra/metabCombiner documentation built on Jan. 26, 2024, 12:23 p.m.