Marita -
I'm not totally sure what you are asking - but it sounds as if you want to
regress your dependent variable on a pre-defined function. To be specific,
suppose your dependent variable is y and your pre-defined function is
log(x), where x is also a Stata variable. Then you could do the following:
.gen fx=log(x)
.reg y fx
This will find a linear transformation of log x (not x) that best fits your
y-variable in a least-squares sense. In other words, y is predicted by b0
+b1*log(x). Note that this model is linear in the coefficients (b0, b1) even
though log(x) is a nonlinear function of x.
On the other hand if you want to predict y by a model that is nonlinear in
the coefficients, such as b0*exp(-b1*x)+b2, then you have to use nonlinear
least squares (the -nl- command).
Hope this helps -
Al Feiveson
-----Original Message-----
From: Marita Jacob [mailto:[email protected]]
Sent: Monday, December 09, 2002 7:50 AM
To: [email protected]
Subject: st: Curve Fit
Hi Stata-Users,
is it possible to use Stata to fit a selected self-defined curve to a line
plot?
I would like to define my own model y=f(x) to be fit to the data (which is
not necessarily the best fitting function, but I am interested in the
particular form of the curve).
Thanks,
Marita Jacob
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/