normal: Functions for generating and fitting named distribution...

View source: R/curveFitTools.R

normalR Documentation

Functions for generating and fitting named distribution functions.

Description

Generate or fit by nonlinear least squares a family of classic distribution functions.

Usage

normal(x, mean = 0, sd = 1, height = NULL, floor = 0)
fit.normal(x, y, start.mean = 0, start.sd = 1, start.height = NULL, start.floor = 0)

gaussian(x, center = 0, width = 1, height = NULL, floor = 0)
fit.gaussian(x, y, start.center = 0, start.width = 1, start.height = NULL, start.floor = 0)

lorentzian(x, center = 0, width = 1, height = NULL, floor = 0)
fit.lorentzian(x, y, start.center = 0, start.width = 1, start.height = NULL, start.floor = 0)

gumbel(x, center = 0, width = 1, height = NULL, floor = 0)
fit.gumbel(x, y, start.center = 0, start.width = 1, start.height = NULL, start.floor = 0)

Arguments

x

a vector of values to evaluate or fit the function at

y

a vector of observed Y values to fit the named distribution to

mean, center

the central value for the function

sd, width

the nominal measure of the width of the distribution. Note that this is a signed value for gumbel distributions, affecting the direction of the asymmetric tail.

height

an optional multiplier for adjusting the magnitude of the Y values returned. By default, the height is defined by the underlying function.

floor

an optional floor value for the tails of the distribution. This has the effect of applying a linear offset to the Y values.

start.center, start.width, start.height, etc.

for the fit. functions, optional starting estimates passed to the NLS routine. See nls. to the Y values.

Value

For the curve generation functions, a vector of Y values, from evaluating the function at all values in X.

For the curve fitting functions, a list containing:

y

a vector of best fit values of Y, at each location in X.

mean, center

the best fit curve parameter of the distribution's central value.

sd, width

the best fit curve parameter of the distribution's width.

height

the best fit curve parameter of the distribution's height.

floor

if fitted, the best fit curve parameter of the distribution's floor (linear offset of the function tails)

Note

While the functions are implemented differently, 'normal' an 'gaussian' are effectively the same.

Author(s)

Bob Morrison


robertdouglasmorrison/DuffyTools documentation built on April 16, 2024, 6:31 a.m.