help-gsl
[Top][All Lists]

## Re: [Help-gsl] Weighted Levenberg Marquardt

 From: John Gehman Subject: Re: [Help-gsl] Weighted Levenberg Marquardt Date: Mon, 17 Aug 2009 22:52:08 +1000

```G'day Tom,

```
I may be misunderstanding your intentions, but if you want to weight your data differentially, you can simply incorporate this into your subroutines which return the residuals vector and jacobian matrix to the minimizer -- "sigma" in the example from the manual, from memory. That is, the data structure which you pass into the minimizer is a vector of x data values, a vector of y data values, and a vector of errors. The objective function to be minimized is the residuals vector with elements i = [ ( y_i - f(x_i,a) ) / sigma_i ], and the partial derivatives include this attenuating factor as well. Meanwhile, the covariance matrix (co-dependence of your optimized parameters in the fit) per se is one of the outputs from the minimization routine.
```
Am I off the mark?

Regards,
john

On 17/08/2009, at 7:57 PM, Tom Banwell wrote:

```
```
Hi,

```
I'm a computer scientist, not a mathematician and had a question about the Levenberg Marquardt (LM) algorithm and hoped someone would be able to help or provide some advice. I wanted to perform weighted Least-Squares and I have the following equation:
```
[ yi - f(xi,a)]^T Vi  [ yi - f(xi,a)]

```
where yi is the dependent variable, xi is the independent variable, a are the model parameters to be estimated, and Vi is a covariance matrix.
```
```
I have solved the problem using an unweighted Least-squares but would prefer to use weighted as some of my data have larger relative uncertainties. I have seen on the GSL reference manual that I can perform weighted Least-Squares using a scalar, but I wanted to use the full covariance matrix, Vi. I did think about using the trace or determinant of Vi, but not sure if that is mathematically as sound so wanted to use Vi. My problem is that I can't work out how to extend my code to include the matrix weight (rather than the scalar weight) and wondered if I needed to modify the internal gsl LM algorithm (or maybe rewrite the algorithm myself) or can apply I apply a matrix weight using the existing gsl LM.
```
```
I hope someone can help with this, my email is: tombanwell * at * hotmail * dot * com
```
Thanks

Tom

_________________________________________________________________
```
Celebrate a decade of Messenger with free winks, emoticons, display pics, and more.
```http://clk.atdmt.com/UKM/go/157562755/direct/01/_______________________________________________
Help-gsl mailing list
```