fit_peaks: Fit chromatographic peaks to an exponential-gaussian hybrid...

fit_peaksR Documentation

Fit chromatographic peaks to an exponential-gaussian hybrid or gaussian profile

Description

Fit peak parameters using exponential-gaussian hybrid or gaussian function.

Usage

fit_peaks(
  x,
  lambda,
  pos = NULL,
  sd.max = 50,
  fit = c("egh", "gaussian", "raw"),
  max.iter = 1000,
  estimate_purity = TRUE,
  noise_threshold = 0.001,
  ...
)

Arguments

x

A chromatogram in matrix format.

lambda

Wavelength to fit peaks at.

pos

Locations of peaks in vector y. If NULL, find_peaks will run automatically to find peak positions.

sd.max

Maximum width (standard deviation) for peaks. Defaults to 50.

fit

Function for peak fitting. (Currently exponential-gaussian hybrid egh, gaussian and raw settings are supported). If raw is selected, trapezoidal integration will be performed on raw data without fitting a peak shape. Defaults to egh.)

max.iter

Maximum number of iterations to use in nonlinear least squares peak-fitting. (Defaults to 1000).

estimate_purity

Logical. Whether to estimate purity or not. Defaults to TRUE.

noise_threshold

Noise threshold. Input to get_purity.

...

Additional arguments to find_peaks.

Details

Peak parameters are calculated by fitting the data to a gaussian or exponential-gaussian hybrid curve using non-linear least squares estimation as implemented in nlsLM. The area under the fitted curve is then estimated using trapezoidal approximation.

Value

The fit_peaks function returns a matrix, whose columns contain the following information about each peak:

rt

Location of the peak maximum.

start

Start of peak (only included in table if bounds = TRUE).

end

End of peak (only included in table if bounds = TRUE).

sd

The standard deviation of the peak.

tau

\tau parameter (only included in table if fit = "egh").

FWHM

The full width at half maximum.

height

Peak height.

area

Peak area.

r.squared

The R-squared value for linear fit of the model to the data.

purity

The spectral purity of peak as assessed by get_purity.

Again, the first five elements (rt, start, end, sd and FWHM) are expressed as indices, so not in terms of the real retention times. The transformation to "real" time is done in function get_peaks.

Note

The fit_peaks function is adapted from Dr. Robert Morrison's DuffyTools package as well as code published in Ron Wehrens' alsace package.

Author(s)

Ethan Bass

References

  • Lan, K. & Jorgenson, J. W. 2001. A hybrid of exponential and gaussian functions as a simple model of asymmetric chromatographic peaks. Journal of Chromatography A 915:1-13. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0021-9673(01)00594-5")}.

  • Naish, P. J. & Hartwell, S. 1988. Exponentially Modified Gaussian functions - A good model for chromatographic peaks in isocratic HPLC? Chromatographia, 26: 285-296. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02268168")}.

See Also

find_peaks, get_peaks

Examples

data(Sa_pr)
fit_peaks(Sa_pr[[1]], lambda = 220)

ethanbass/chromatographR documentation built on April 17, 2025, 10:55 a.m.