Dear Brian,

here is the main loop:

    computeWeightsByYi(); // computes weights for the first round
    do {
        iter++;
        status = gsl_multifit_fdfsolver_iterate(s);
        if (status) break;
        status = gsl_multifit_test_delta(s->dx, s->x, 1e-4, 1e-4);
        if (movingWeights) { // boolean to switch re-weighted and
"normal" regression
            gsl_vector *params = gsl_vector_alloc(s->x->size);
            gsl_vector_memcpy(params, s->x);
            setParameters(params); // copies current model parameters
into the enclosing object member data field
            computeWeightsByFx(); // computes new weights from the new
set of parameters for the next iteration
        }
    }
    while ((status == GSL_CONTINUE) && (iter < 10000));

The solver is gsl_multifit_fdfsolver_lmsder.

The function is f(x) = a * exp(b * (x+0.5)) / (1 + a * exp(b * (x+0.5)))

With nearly certainty, the problem is on my side, but I wanted to be
sure that re-weighting is o.k. with GSL or that I will need another
approach. I am not a matematician, but I am pretty sure the partial
derivatives etc. are o.k. in my case - my colleague uses another
computing method with a success, but he has it as a set of VBA macros
in Excel and we need to do it in C/C++. For some reason I think GSL will
be better choice than blindly rewrite code lines from VBA to C++. What I
like to know is if I am using the GSL right for this type of problem.

Thank you. Kind regards,

  David

.
Dne 6.11.2010 18:46, Brian Hawkins napsal(a):
> David,
>
> What's your convergence criterion?  Is your system full-rank?  Have you had
> success with this problem using a different solver?  I'm having a hard time
> understanding why the GSL solver in particular would be giving you trouble.
>
> Regards,
> Brian
>
> On Sat, Nov 6, 2010 at 9:01 AM, <[email protected]> wrote:
>> Message: 1
>> Date: Fri, 05 Nov 2010 23:09:54 +0100
>> From: David Komanek <[email protected]>
>> Subject: [Help-gsl] iteratively re-weighted least squares fitting
>> To: [email protected]
>> Message-ID: <[email protected]>
>> Content-Type: text/plain; charset=ISO-8859-2
>>
>> Dear all,
>>
>> I ran into problems using weighted least squares fitting in GSL. For
>> some reason I need to use IRLS modification of this method, so the
>> weights are recomputed in every iteration. In the case the weights are
>> computed at the beginning and being constant throug all the iterations,
>> the procedure works fine. But when I adjust the weights in every
>> iteration, this usually leads to an error:
>>
>> 27 iteration is not making progress towards solution
>>
>> I think it is because there are some internally tested conditions and
>> some of them are not satisfied in this case. For example, in SAS, there
>> is a special parameter to relax those conditions:
>>
>>
>> http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_nlin_sect034.htm
>>
>> Is something like this possible with GSL ?
>>
>> Thank you in advance.
>>
>> David
>>
> _______________________________________________
> Help-gsl mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-gsl

_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to