help-octave
[Top][All Lists]

## Re: Nonlinear fitting with lg(a+x)

 From: Michael Creel Subject: Re: Nonlinear fitting with lg(a+x) Date: Mon, 16 Mar 2009 04:27:23 -0700 (PDT)

```

reposepuppy wrote:
>
>
>
> Michael Creel wrote:
>>
>> You don't need to linearize anything, just use nonlinear least squares to
>> minimize the function
>>
>>      sum_over_observations [ r-r0[1-a*lg(1+c/b)] ]^2  with respect to the
>> unknown constants.
>>
>> If you linearize and then estimate, the resulting estimator is biased and
>> inconsistent. All you need to do is write Octave code to calculate the
>> objective function. Then you can use one of the available minimizers to
>> get the estimates. Octave provides sqp, which can handle this problem.
>>
>
> I can't find the function sum_over_observations... Is it a function I have
> to make up by myself, or some packages submitted somewhere other than
> octave-forge?
> And..."All you need to do is write Octave code to calculate the objective
> function."
> It might sound silly, but I really don't know (and I don't know where I
> can find the tutorial) how to calculate it, and how to use the minimizers.
> I've read the octave.pdf file and the function reference on octave-forge,
> and I could only found one minimizer called polyfit(x,y,n), which is used
> to make polynomial fittings...
> Could you give me a detailed demonstration/code to work it out? The data
> has been collected in the attachment.
> http://www.nabble.com/file/p22535164/data%2Bc%2Band%2Br.txt
> data+c+and+r.txt
>

For an example of minimization of a function, you could install the package
"optim", and then run "bfgsmin_example".

For your problem, you  would just need to replace the objective function in
that example with the one for your problem, Doing that is not hard if you