help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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".
http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/optim/inst/bfgsmin_example.m?revision=HEAD&content-type=text/plain

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
know a little about Octave. 

-- 
View this message in context: 
http://www.nabble.com/Nonlinear-fitting-with-lg%28a%2Bx%29-tp22492005p22536278.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]