help for curvefit version 4.0
get the newest version

Curve Estimation

Description

curvefit procedure produces curve estimation regression statistics and related plots between two variables for 35 different
curve estimation regression models. curvefit based on the Stata command nl which fits an arbitrary nonlinear regression function by least squares.

Syntax

curvefit
depvar indepvar [if] [in] [weight]
, function(string) [nograph initial(string) count(integer)
vce(string) scheme(string) saving(filename [, suboptions])]

* function(string) The following are alternative Models correspond with the values of the sting:

. string = 1 Linear: Y = b0 + (b1 * X)

. string = 2 Logarithmic: Y = b0 + (b1 * ln(X))

. string = 3 Inverse: Y = b0 + (b1 / X)

. string = 4 Quadratic: Y = b0 + (b1 * X) + (b2 * X^2)

. string = 5 Cubic: Y = b0 + (b1 * X) + (b2 * X^2) + (b3 * X^3)

. string = 6 Power: Y = b0 * (X^b1) OR ln(Y) = ln(b0) + (b1 * ln(X))

. string = 7 Compound: Y = b0 * (b1^X) OR ln(Y) = ln(b0) + (ln(b1) * X)

. string = 8 S-curve: Y = e^(b0 + (b1/X)) OR ln(Y) = b0 + (b1/X)

. string = 9 Logistic: Y = b0 / (1 + b1 * e^(-b2 * X))

. string = 0 Growth: Y = e^(b0 + (b1 * X)) OR ln(Y) = b0 + (b1 * X)

. string = a Exponential: Y = b0 * (e^(b1 * X)) OR ln(Y) = ln(b0) + (b1 * X)

. string = b Vapor Pressure: Y = e^(b0 + b1/X + b2 * ln(X))

. string = c Reciprocal Logarithmic: Y = 1 / (b0 + (b1 * ln(X)))

. string = d Modified Power: Y = b0 * b1^(X)

. string = e Shifted Power: Y = b0 * (X - b1)^b2

. string = f Geometric: Y = b0 * X^(b1 * X)

. string = g Modified Geometric: Y = b0 * X^(b1/X)

. string = h nth order Polynomial: Y = b0 + b1*X + b2*X^2 + b3*X^3 + b4*X^4 + b5*X^5 ...

. string = i Hoerl: Y = b0 * (b1^X) * (X^b2)

. string = j Modified Hoerl: Y = b0 * b1^(1/X) * (X^b2)

. string = k Reciprocal: Y = 1 / (b0 + b1 * X)

. string = l Reciprocal Quadratic: Y = 1 / (b0 + b1 * X + b2 * X^2)

. string = m Bleasdale: Y = (b0 + b1 * X)^(-1 / b2)

. string = n Harris: Y = 1 / (b0 + b1 * X^b2)

. string = o Exponential Association: Y = b0 * (1 - e^(-b1 * X))

. string = p Three-Parameter Exponential Association: Y = b0 * (b1 - e^(-b2 * X))

. string = q Saturation-Growth Rate: Y = b0 * X/(b1 + X)

. string = r Gompertz Relation: Y = b0 * e^(-e^(b1 - b2 * X))

. string = s Richards: Y = b0 / (1 + e^(b1 - b2 * X))^(1/b3)

. string = t MMF: Y = (b0 * b1+b2 * X^b3)/(b1 + X^b3)

. string = u Weibull: Y = b0 - b1*e^(-b2 * X^b3)

. string = v Sinusoidal: Y = b0+b1 * b2 * cos(b2 * X + b3)

. string = w Gaussian: Y = b0 * e^((-(b1 - X)^2)/(2 * b2^2))

. string = x Heat Capacity: Y = b0 + b1 * X + b2/X^2

. string = y Rational: Y = (b0 + b1 * X)/(1 + b2 * X + b3 * X^2)

. string = ALL refers to a total of above models (Attention: it's uppercase!)

* nograph Curve Estimation without curve fit graph.

* initial(string) initial values for parameters.

* count(integer) set order of model 'nth order Polynomial' (default=4).

* vce(string) may be gnr, robust, bootstrap, jackknife, hc2, hc3 or 'cluster clustvar'.

* scheme(string) Set default scheme.

* saving(string) save graph to disk. 'saving(filename [, suboptions])' specifies the name of the diskfile to be created or replaced.
If filename is specified without an extension, '.gph' will be assumed. asis specifies that the graph be frozen and saved just as it is. The alternative -- and the default if asis is not specified -- is known as live format.

Note:
(1)Some of the equations must initial values for parameters. (2)As for the model 'nth order Polynomial', you should use the option count(integer) to set the order of it. (3)aweights, fweights, and iweights are allowed.

Examples

(1) sysuse auto

. curvefit between variables weight and length for models 6, 8, 0 with a related plots:

. curvefit weight length if foreign==0, f(681a)

. curvefit between variables with scheme 's2mono':

. curvefit weight length if foreign==0, f(124) sche(s2mono)

. curvefit between variables and save graph 'curve_1.gph' to disk:

. curvefit weight length if foreign==0, f(124) sav(curve_1)

. curvefit between variables and replace with the asis graph 'curve_1.gph':

. curvefit weight length if foreign==0, f(124) sav(curve_1, replace asis)

. curvefit for all models with no related plots:

. curvefit weight length, f(ALL) n

. then choose models with bigger adjusted R-squared which curvefit the data better:

. curvefit weight length, f(681abfg)

(2) sysuse temptime -- You can get the data file from here

. curvefit for 5th order Polynomial models:

. curvefit temperature time, f(h) c(5)

. curvefit for Logistic models with initial values for parameters:

. curvefit temperature time, f(9) i(b0 2 b1 1.5 b2 0.1)

. curvefit for Reciprocal Quadratic models with initial values for parameters:

. curvefit temperature time, f(l) i(b0 1 b1 0 b2 3)

. curvefit for Sinusoidal models with initial values for parameters:

. curvefit temperature time, f(v) i(b0 3 b1 0.5 b2 0.05 b3 -5)

Acknowledgments

I wish to thank Richard Williams (Notre Dame Dept of Sociology) for his good advise.

For problems and suggestions

Author: Liu wei, Yunnan University of Finance and Economics. Address: Longquan Road 237, Wuhua District, Kunming, Yunnan, P.R.China. ZIP Code: 650221.
E-mail: liuwei@ynufe.edu.cn

Also see

Other Commands I have written:

deci (if installed) ssc install deci (to install)

fdta (if installed) ssc install fdta (to install)

ftrans (if installed) ssc install ftrans (to install)

freplace (if installed) ssc install freplace (to install)

elife (if installed) ssc install elife (to install)

ftree (if installed) ssc install ftree (to install)

fren (if installed) ssc install fren (to install)

equation (if installed) ssc install equation (to install)