gaussian: Generate and/or Fit Gaussian Data

Description Usage Arguments Value Note Author(s) References

View source: R/gaussian.R View source: R/curveFitTools.R

Description

Generate a vector of values that represent a Gaussian distribution. Secondly, apply a nonlinear least squares fit to gaussian data to determine the fitted gaussian function.

Usage

1
2
3
gaussian(x, mean = 0, sd = 1, height = NULL, offset = 0)

fit.gaussian( x, y, fit.offset = TRUE)

Arguments

x

vector of X locations to evaluate the gaussian at. For 'fit.gaussian', the locations at which the measured Y values are taken from.

mean

the center locatinon X for the generated gaussian curve

sd

the standard deviation for the generated gaussian curve

height

the maximum height of the generated gaussian curve. By default, the curve will have height such that its integral equals 1.

offset

the linear offset for the baseline of the generated gaussian curve

y

the raw data measurements at 'x', that are to be fit by a gaussian model.

fit.offset

logical, should the model include the offset term, to fit the baseline tails of the raw data.

Value

For 'gaussian', a vector of length length(x), that gives the amplitude of that gaussian function evaluated at x.

For fit.gaussian, a list:

coefficients

a vector of named coefficients (mean, sd, height, offset) giving the parameters of the best fit gaussian model.

y

a vector of the same length as y, giving the fitted result of the gaussian model.

Note

Implemented via nls

Author(s)

Bob Morrison

References

based on code from: Earl F. Glynn, Stowers Inst for Medical Research


robertdouglasmorrison/DuffyTools documentation built on Dec. 7, 2018, 8:02 a.m.