Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

error intervals on fitted parameters in PDL::Fit::LM

by dwm042 (Priest)
on Oct 26, 2007 at 17:36 UTC ( [id://647444]=perlquestion: print w/replies, xml ) Need Help??

dwm042 has asked for the wisdom of the Perl Monks concerning the following question:

I'm growing interested in curve fitting some data, and looking at the tools available in Perl. Most aren't robust enough for anything serious, or they lack any kind of error analysis, but PDL::Fit::LM seems a pretty serious bit of code. It returns a covariance matrix, and I can get a standard error from the square root of the diagonal terms of the matrix, and can calculate a cross correlation coefficient from the off diagonal terms divided by the square root of the product of the two relevant diagonal terms.

What I don't recall are some of the subtleties of getting error limits on the fitted parameters. Michael L. Johnson of the Biophysics Department of the University of Virginia was big on this; big on analysis of residuals and calculating true confidence intervals of fitted parameters (in no small part because fitted parameters of real world problems are often highly correlated).

Anyway, the specifics of doing these kinds of analyses escape me presently and I'm not that close to a research library (if I were, i'd just walk down Michael's publication list and find what I need). Has someone turned this kind of "stuff" into a Perl module? If not, what gotcha's are out there? I worked in biophysical chemistry long ago. Issues peculiar to the models I used may not be an issue in other unrelated fields.

Updated: links Further Updated:

A deeper comparison and test of PDL::Fit::LM has revealed issues. If you take the test code provided on CPAN, and reduce the value of the Y data by a factor of 10, the covariance matrix does not change. If you take the test code provided by CPAN and reduce the error in the Y data by a factor of 10, the covariance matrix does not change. Therefore, the covariance matrix is being normalized, but to what? Although it is likely normalized versus the sum of squared residuals, the implementation does not say. Further, the algorithm does not return any goodness of fit ( no SSR or chi squared).

Examination of the levmar documentation (according to the Wikipedia, PDL::Fit::LM is based on levmar) shows an array info that gives a much richer description of the fitting process, and access to the sum of squares required to assess goodness of fit. So I guess I'm still looking.

  • Comment on error intervals on fitted parameters in PDL::Fit::LM

Replies are listed 'Best First'.
Re: error intervals on fitted parameters in PDL::Fit::LM
by etj (Deacon) on Jun 07, 2022 at 04:33 UTC
    In fact, PDL::Fit::Levmar is based on lourakis's levmar. PDL::Fit::LM uses PDL functions from Perl, including PDL::Slatec LINPACK functions for matrix inversion.

    For anyone who looks into this (I assume that in the last 15 years, the OP has either solved their problem, or moved on), reading the Perl source of ::LM and/or the docs of ::Levmar will help. I am not an expert in this field.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://647444]
Approved by almut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-24 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found