This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fixing parameters for nonlinear least squares fitting


Hi,

I do the following when using the gsl_multimin minimisers (no least
squares, but minimisation of a general function):

I add some administration between the model evaluation and the parameter
fit procedure, in order to keep track of which parameters are fixed
and which are free.

The parameter fitter only sees the free parameters.

Before evaluation, I 'unpack' the vector of free parameters provided from
the gsl fitter, and add the fixed parameters to pass a complete vector
with all parameters to the model evaluation.

After evaluation, I select the relevant terms from the jacobian and
construct a smaller jacobian which is returned to the gsl fitter.
(Actually it is faster to evaluate only those derivatives that belong to
free parameters)

Some extra administration is necessary outside the fitter to select the
proper initial values for the free parameter vector and to initialize the
fitter with the proper dimensions (number of free parameters). Also,
things fail when all parameters are fixed as gsl frowns upon vectors of
size zero.

This all sounds rather cumbersome but in fact the administration routines
are quite small.

I don't know how much of this is the same for the least squares routine,
hope this is of interest. Also, if you find a better way, I would be
interested to know your solution.

Greetings,
Fleur

> Hi
> I'm working on a program that fits some data using the noninear least
> squares routines from GSL.  I have written a C++ object that implements
> the example from the manual pages.  This works very well.  Now I'd like
> to be able to select which parameters are fitted - experience shows that
> some parameters are best fitted independently of others.  My idea was to
> set the relevent terms in the Jacobian to zero - thinking that this
> would effectively meant that these parameters were at their ideal
> values.  Unfortunately, doesn't work.  The fixed parameter goes to
> infinity and the other parameters go to NaN.
>
> Does anybody know A way around this?
>
> Simon
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]