Least Squares

Discussion in 'Perl Misc' started by alexxx.magni@gmail.com, Nov 5, 2007.

  1. Guest

    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
     
    , Nov 5, 2007
    #1
    1. Advertising

  2. "" <> wrote in
    news::

    > 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 <>
    (remove .invalid and reverse each component for email address)
    clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>
     
    A. Sinan Unur, Nov 5, 2007
    #2
    1. Advertising

  3. Guest

    On 6 Nov, 00:24, "A. Sinan Unur" <> wrote:
    > "" <> wrote innews::
    >
    > > 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
     
    , Nov 6, 2007
    #3
  4. "" <> wrote in
    news::

    > On 6 Nov, 00:24, "A. Sinan Unur" <> wrote:
    >> "" <> wrote
    >> innews::
    >>
    >> > 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 <>
    (remove .invalid and reverse each component for email address)
    clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>
     
    A. Sinan Unur, Nov 6, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. venkat
    Replies:
    3
    Views:
    1,577
    Robert Kern
    Jun 1, 2005
  2. Replies:
    9
    Views:
    846
    Tim Roberts
    Mar 17, 2006
  3. Replies:
    9
    Views:
    721
    Mark Jeffcoat
    Oct 19, 2006
  4. AAaron123
    Replies:
    0
    Views:
    615
    AAaron123
    Oct 3, 2008
  5. Evelien
    Replies:
    4
    Views:
    351
    Evelien
    Oct 29, 2008
Loading...

Share This Page