Least Squares

Least Squares

am 05.11.2007 20:26:33 von alexxx.magni

Hi everybody,
I need to perform a huge number of Least Squares Fits to my data,
using probably something like a+b*Atan(c-d*x) as the fitting function.
Can you suggest me the fastest package on CPAN, according to you?

Thanks for any help!


Alessandro Magni

Re: Least Squares

am 06.11.2007 00:24:59 von 1usa

"alexxx.magni@gmail.com" wrote in
news:1194290793.569055.310260@o38g2000hse.googlegroups.com:

> I need to perform a huge number of Least Squares Fits to my data,
> using probably something like a+b*Atan(c-d*x) as the fitting function.
> Can you suggest me the fastest package on CPAN, according to you?

First off, if you can't reduce that functional form to a form that is
linear in parameters, you are going to need to resort to numerical
optimization.

Second, I would be more inclined to open a pipe to R or Octave (I have no
idea if they can do this particular estimation) for any serious statistics.

Finally, you do not mention what you mean by 'fast'.

Sinan

--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines:

Re: Least Squares

am 06.11.2007 08:59:20 von alexxx.magni

On 6 Nov, 00:24, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> "alexxx.ma...@gmail.com" wrote innews:1194290793.569055.310260@o38g2000hse.googlegroups.com :
>
> > I need to perform a huge number of Least Squares Fits to my data,
> > using probably something like a+b*Atan(c-d*x) as the fitting function.
> > Can you suggest me the fastest package on CPAN, according to you?
>
> First off, if you can't reduce that functional form to a form that is
> linear in parameters, you are going to need to resort to numerical
> optimization.

It could be still OK for me - do you know of any module able to do
this?

> Second, I would be more inclined to open a pipe to R or Octave (I have no
> idea if they can do this particular estimation) for any serious statistics.

I'm not an expert on R/Octave, but sometimes I tried linking C and
Mathematica - I dont know if Perl can handle this...

> Finally, you do not mention what you mean by 'fast'.

Well, the project involves the processing of simple PGM images (0..255
graylevels) of an interface swapping the image, turning it from black
to white.
So every pixel of the 691x517 images (300 of them!) will behave in
time (time=1..300) approximately as a step function (thats why I use
Atan) with noise overimposed.
I "simply" need to know, for every pixel, at which time the step
appears, to be able to precisely reconstruct the interface.
.... that's what I meant by "fast"!


thanks for your help,

Alessandro

Re: Least Squares

am 06.11.2007 14:03:50 von 1usa

"alexxx.magni@gmail.com" wrote in
news:1194335960.669911.315710@y42g2000hsy.googlegroups.com:

> On 6 Nov, 00:24, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> "alexxx.ma...@gmail.com" wrote
>> innews:1194290793.569055.310260@o38g2000hse.googlegroups.com :
>>
>> > I need to perform a huge number of Least Squares Fits to my data,
>> > using probably something like a+b*Atan(c-d*x) as the fitting
>> > function. Can you suggest me the fastest package on CPAN, according
>> > to you?
>>
>> First off, if you can't reduce that functional form to a form that is
>> linear in parameters, you are going to need to resort to numerical
>> optimization.
>
> It could be still OK for me - do you know of any module able to do
> this?

No.

>> Second, I would be more inclined to open a pipe to R or Octave (I
>> have no idea if they can do this particular estimation) for any
>> serious statistics.
>
> I'm not an expert on R/Octave, but sometimes I tried linking C and
> Mathematica - I dont know if Perl can handle this...

Perl can handle all sorts of things but at this point your problem
is too ambiguously specified. Anything I say will be pure speculation
and likely wrong for your problem.


>> Finally, you do not mention what you mean by 'fast'.
>
> Well, the project involves the processing of simple PGM images (0..255
> graylevels) of an interface swapping the image, turning it from black
> to white.
> So every pixel of the 691x517 images (300 of them!) will behave in
> time (time=1..300) approximately as a step function (thats why I use
> Atan) with noise overimposed.
> I "simply" need to know, for every pixel, at which time the step
> appears, to be able to precisely reconstruct the interface.
> ... that's what I meant by "fast"!

Again, this is too ambiguous for me. What is x and what is y in the
equation you specified above? What does it mean to
'reconstruct the interface'?

Take a look at:

http://cran.r-project.org/doc/contrib/Fox-Companion/appendix -nonlinear-regression.pdf

Read perldoc perlipc and perldoc IPC::Open3. I would be inclined to
open a pipe to an external program (such as R) at the beginning of your
script and let that program perform the computations.

Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: