[SciPy-User] data fitting, constraints, covariance matrix
Björn Nadrowski
bjrnfrdnnd@googlemail....
Fri Oct 23 05:01:33 CDT 2009
Hello,
is there a way of solving a problem with the following specifications?
I would like to do classical data fitting, having a set of predictor
observations , x_i, and a set of response observations, y_i.
i goes from 1 to n; n would be the number of data points.
For the sake of simplification, let us assume that a single predictor
datapoint and a single response datapoint is a scalar value.
I would then have a function f(p,x) that has a number of parameters p
(let us say p is a vector of length q)
Associated with x_i and y_i , I would have a set of experimentally
measured errors, sigma_x_i and sigma_y_i.
I would then like to perform an orthogonal distance reduction,
minimizing the function
\sum_{i=1}^n ( ( 1 / sigma_y_i)² * (f(p, x_i + delta_i) - y_i)² + (1/
sigma_x_i)² * delta_i² )
by varying the p_j and the delta_i, where j goes from 1 to q.
This is classical orthogonal distance reduction with weighted input
variables, and it is performed py scipy.odr, also for datapoints of
multiple dimensions.
Scipy.odr nicely calculates some local minimum, and also calculates
the covariance matrix, and asymptotic standard errors.
It also allows the user to fix some of the p_i during fitting, such
that only a subset of the p_i is varied in order to find a local
minimum.
What scipy.odr does not provide, and I am looking for a program that
does that, is: there are no constraints.
There is no way to specify that the p_i should have boundaries, and
there is no way to specify non-local constraints
such as
p_1*p_2 = p_3
In the openopt library, I have noticed that such constraints are
routinely handled, and that there are also box constraints such as
0<p_1<10
.
What I did not find in the openopt framework, is the handling of
weights, or errors, on the datapoints in the way I just exposed.
Neither did I find that a covariance matrix is calculated, or that
asymptotic standard errors are being computed.
My question would be, whether there is a simple way to fit such a
nonlinear problem using openopt, or scipy, or a combination of both,
with constraints on the parameters, errors on predictor and response
variables, possible fixing of some of the parameters during
minimization, calculation of the covariance matrix at the minimum and
calculation of standard errors for the parameter values.
If there is, please tell me how a simple problem would be solved.
Thanks for any help in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091023/516e8f5d/attachment.html
More information about the SciPy-User
mailing list