peakFitter: peakFitter

View source: R/Functions_extract_EICs.R

peakFitterR Documentation

peakFitter

Description

fit a curve into a numeric vector. Will recursively try different starting values for the optimizer.

Usage

peakFitter(
  x,
  y,
  m,
  s,
  startdepth = 1,
  maxdepth = 5,
  best_estimate = 0,
  allowWorseScore = F
)

Arguments

x

numeric vector to use as inout for fit function (typically series of scan numbers or retention time values)

y

numeric vector to fit the curve, same length as x

m

numeric value of the expected/initial position of the peak apex (in range of x)

s

numeric value of the expected/initial peak width. Should not be 0!

startdepth

defaults to 1, part of limiting the recursion

maxdepth

limits recursion to trying to fit curve maxdepth times with increasing s values

best_estimate

Best estimate from previous iterations - argument carries previous results through recursion

allowWorseScore

if FALSE, recursion ends when an iteration has a worse result than the previous one, and will return the best result up to that point

Details

Elements in returned list:

  • depth integer indicationg recursion depth

  • fit result of using nls() on x with peakFunction(), followed by fitted()

  • cor result of calling cor.test() on y and fit

Value

a list, see details


mjhelf/METABOseek documentation built on April 27, 2022, 5:13 p.m.