Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

COMFIT


Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The COMFIT function fits the paired data {xi, yi} to one of six common types of approximating models using a gradient-expansion least-squares method.

This routine is written in the IDL language. Its source code can be found in the file comfit.pro in the lib subdirectory of the IDL distribution.

Syntax

Result = COMFIT( X, Y, A {, /EXPONENTIAL | , /GEOMETRIC | , /GOMPERTZ | , /HYPERBOLIC | , /LOGISTIC | , /LOGSQUARE} [, SIGMA=variable] [, WEIGHTS=vector] [, YFIT=variable] )

Return Value

Results in a vector containing the model parameters a0, a1, a2, etc.

Arguments

X

An n-element integer, single-, or double-precision floating-point vector.

Y

An n-element integer, single-, or double-precision floating-point vector.

A

A vector of initial estimates for each model parameter. The length of this vector depends upon the type of model selected.

Keywords

Note
One of the following keywords specifying a type of model must be set when using COMFIT. If you do not specify a model, IDL will display a warning message when COMFIT is called.

EXPONENTIAL

Set this keyword to compute the parameters of the exponential model.

GEOMETRIC

Set this keyword to compute the parameters of the geometric model.

GOMPERTZ

Set this keyword to compute the parameters of the Gompertz model.

HYPERBOLIC

Set this keyword to compute the parameters of the hyperbolic model.

LOGISTIC

Set this keyword to compute the parameters of the logistic model.

LOGSQUARE

Set this keyword to compute the parameters of the logsquare model.

SIGMA

Set this keyword to a named variable that will contain a vector of standard deviations for the computed model parameters.

WEIGHTS

Set this keyword equal to a vector of weights for Yi. This vector should be the same length as X and Y. The error for each term is weighted by WEIGHTSi when computing the fit. Frequently, WEIGHTSi = 1.0/si2, where s is the measurement error or standard deviation of Yi (Gaussian or instrumental weighting), or WEIGHTS = 1/Y (Poisson or statistical weighting). If WEIGHTS is not specified, WEIGHTSi is assumed to be 1.0.

YFIT

Set this keyword to a named variable that will contain an n-element vector of y-data corresponding to the computed model parameters.

Examples

; Define two n-element vectors of paired data: 
X = [ 2.27, 15.01, 34.74, 36.01, 43.65, 50.02, 53.84, 58.30, $ 
     62.12, 64.66, 71.66, 79.94, 85.67, 114.95] 
Y = [ 5.16, 22.63, 34.36, 34.92, 37.98, 40.22, 41.46, 42.81, $ 
     43.91, 44.62, 46.44, 48.43, 49.70, 55.31] 
 
; Define a 3-element vector of initial estimates for the logsquare 
; model: 
A = [1.5, 1.5, 1.5] 
 
; Compute the model parameters of the logsquare model, A[0], A[1], 
; & A[2]: 
result = COMFIT(X, Y, A, /LOGSQUARE) 

The result should be the 3-element vector: [1.42494, 7.21900, 9.18794].

Version History

Introduced: 4.0

See Also

CURVEFIT, LADFIT, LINFIT, LMFIT, POLY_FIT, SVDFIT


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]