gauss_fit {gcxgclab}R Documentation

Fitting to Gaussian curve

Description

gauss_fit fits data around a peak to a Gaussian curve.

Usage

gauss_fit(TIC_df, peakcoord)

Arguments

TIC_df

a data.frame object. Data frame with 4 columns (Overall Time Index, RT1, RT2, TIC), ideally the output from create_df(), or the first data frame returned from extract_data(), $TIC_df.

peakcoord

a vector object. The two dimensional time retention coordinates of the peak of interest. c(RT1,RT2).

Details

This function fits data around the specified peak to a Gaussian curve, minimized with nonlinear least squares method nls() from "stats" package.

Value

A list object with three items. The first data.frame object. A data frame with two columns, (time, guassfit), the time values around the peak, and the intensity values fitted to the optimal Gaussian curve. Second, a vector object of the fitted parameters (a,b,c). Third, a double object, the area under the fitted Gaussian curve.

Examples

file <- system.file("extdata","sample1.cdf",package="gcxgclab")
frame <- extract_data(file,mod_t=.5)
peaks <- top_peaks(frame$TIC_df, 5)
gaussfit <- gauss_fit(frame$TIC_df, peakcoord=c(peaks$'X'[1], peaks$'Y'[1]))
message(paste('Area under curve =',gaussfit[[3]], 'u^2'))
plot_gauss(frame$TIC_df, gaussfit[[1]])


[Package gcxgclab version 1.0.1 Index]