[SciPy-user] fit confidence intervals from minpack.leastsq, or odrpack.ODR?

Zane Selvans zane at ideotrope.org
Mon Aug 11 20:52:21 EDT 2008


I have an observation, L, which consists of the shape of a particular  
one dimensional feature (a line on the surface of a sphere).

I have a model of the process that I think may have generated the  
feature.  Aside from the feature, L, the model has one parameter, B  
(an angle: 0 < B < pi).

For a given feature and parameter value, I can calculate a metric  
f(B,L) describing how well my observation matches the model.  f(B,L)  
has the following properties:
   - Small values of f(B,L) indicate agreement with my model, large  
f(B,L) indicate disagreement.
   - f(B,L) is periodic (with a wavelength of pi radians)
   - f(B,L) may have several local minima
   - 0 < f(B,L) < pi/2

I need to somehow quantify three things:
   i)   At its best, how good is my model at explaining the  
observation (i.e. is it good enough to be significant?)
   ii)  For what value of the input parameter does my model do the  
best job of explaining the observation?
   iii) How unique is that best value (i.e. are there many other  
values that do almost as well?)

Currently, I'm using the global minimum of f(B,L) for i, and the value  
of B which results in the global minimum for ii.  I'm kind of stuck on  
iii though.  My current idea is to fit f(B,L) to some periodic  
function (e.g. cosine), and use the width of the 95% confidence  
interval of that fit as an indication of its uniqueness.  If I use a  
function with the same wavelength (pi) as f(B,L), set its amplitude to  
be whatever the observed amplitude of f(B,L), and its phase such that  
the minimum of both f(B,L) and the cosine... I'll get a fit of some  
confidence.  Or alternatively, I could allow the fitting function to  
determine the phase, and instead of using the global minimum of f(B,L)  
as the value which determines the best value of B, I could use the  
minimum of the fit cosine.  Or I could just not worry about whether or  
not they're the same, and use the best-fit confidence interval as the  
measure of uniqueness.

Does that sound at all like the right way to go about this?

If so, which fitting/minimization module is more appropriate/easier to  
use (if what I want is the confidence interval, ultimately)  
minpack.leastsq or odrpack.ODR.  I see that leastsq returns a  
covariance matrix, and that it's possible somehow to turn that into a  
confidence interval... and it looks like you can get a confidence  
interval (sd_beta) directly from ODR.

Thanks for any insight...

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
zane at ideotrope.org
303/815-6866
PGP Key: 55E0815F




More information about the SciPy-User mailing list