# Re: Re: st: Stata command for parameter calculation with least square method?

 From "Tobias Pfaff" To Subject Re: Re: st: Stata command for parameter calculation with least square method? Date Fri, 2 Mar 2007 00:45:14 +0100

```Thanks a lot, it did help, indeed!

And for those who are desperately seeking for a way to save the coefficient
result of -nl-: -display _b[coefficient_name]-

Cheers,
Tobias

------ Maarten buis <maartenbuis@yahoo.co.uk> wrote:

looks to me like a problem for -nl-, see: -help nl-

Hope this helps,
Maarten

--- Tobias Pfaff <tobiaspfaff@gmx.net> wrote:

> Hi,
>
> for given data points I want to find out a parameter for a function
> such
> that the function fits best to the data points.
> The function would be: f(x)=x^alpha.
> The data points are:
>
> x_values	y_values
> --------	--------
> 0,0000	0
> 0,0156	0,45
> 0,0313	0,52
> 0,0625	4,83
> 0,0938	11,66
> 0,1250	12,79
> 0,1875	21,5
> 0,2188	25,69
> 0,2344	27,89
> 0,2500	29,93
>
> I know how I could do that with the least square method and the Excel
> solver.
> Which Stata command would deliver the same result? Is _reg3_ the
> appropriate
> command? How would the command line look like?
>
> Furthermore, I want to do the same with 2 unknown parameters, e.g.
> for the
> function f(x)=-k*(-x)^alpha. Which command would be appropriate for 2
> unknown parameters (here: k and alpha)?
>
> Any comments would be greatly appreciated.
>
> Cheers,
> Tobias Pfaff
>
> University of Muenster
> Germany
>
> *
> *   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/
>

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

*
*   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/
```