PDA

View Full Version : constrained weighted linear least square fit



pm
02-28-2007, 08:15 PM
I need to do a simple weighted linear least square fit. However, I also need to impose non-negativity constraints on the linear coefficients. I have not been able to identify the function in the C library that will allow me to do this. Could someone point it out to me? Thanks in advance.

pm
03-17-2007, 11:59 PM
I found an answer to my own question a while ago, so I thought I would just post it here. The best function to use is imsl_[d|f]_quadratic_prog. Most of the work is spent setting up the Hessian (h) and linear terms (g) matrices (see the documentation). However, in the presence of a linear system, both h and g will obey general "recipes" which can be used in simple loops to set up both matrices. The weights are factored at the level of h and g directly in the evaluation of each of their elements.

Richard Hanson
03-19-2007, 04:23 PM
Mathematically this is a way to solve such a problem. A direct approach using the weighted regression equations with non-negative constraints on the variables has several advantages. For one thing this alternate problem will be much better conditioned. It does not take a matrix multiply to get the data defined. It is also easier to recognize dependent variables and ignore using them - leave them at the value zero. VNI does not have a solver of this kind in the C library but there is one in the Fortran library. These comments are for your information in case the QP approach fails.