deconvolve_fff: Deconvolve incompletely resolved peaks

Description Usage Arguments Value Examples

View source: R/deconvolve_fff.R

Description

Deconvolve incompletely resolved peaks

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
deconvolve_fff(
  x,
  y,
  h,
  mu,
  s,
  g = NULL,
  fn = "skew_gaussian",
  algorithm = "port",
  iter = 300,
  tol = 0.1
)

Arguments

x

A vector of retention times.

y

A vector of detector responses.

h

A vector of guesses for peak height, with length equal to the desired number of peaks.

mu

A vector of guesses for peak means, with length equal to the desired number of peaks.

s

A vector of guesses for peak standard deviations, with length equal to the desired number of peaks.

g

A vector of guesses for peak shape parameters, with length equal to the desired number of peaks. Silently ignored if 'fn == "normal'.

fn

Function for peak fitting: Gaussian, skew Gaussian or exponentially modified Gaussian ("normal", "skew_gaussian" or "emg").

algorithm

Refer to nls() in the 'stats' package.

iter

Refer to nls() in the 'stats' package.

tol

Refer to nls() in the 'stats' package.

Value

A list containing the nls() model, the fitted model evaluated at x, and a tibble with a column for each of the component peaks evaluated at x.

Examples

1
2
3
4
5
set.seed(0)
x <- seq(0, 10, length.out = 100)
# two gaussian peaks:
y <- exp(-(x - 3) ^ 2 / 2) + exp(-(x - 7) ^ 2 / 2) + rnorm(100, 0, .1)
deconvolve_fff(x, y, h = c(1, 1), mu = c(3, 7), s = c(1, 1), fn = "normal")

zhengfj1994/MeTEA documentation built on June 29, 2021, 5:21 a.m.