help-gsl
[Top][All Lists]

## [Help-gsl] very naive question: how to fit _correctly_ an histogram ?

 From: Jerome BENOIT Subject: [Help-gsl] very naive question: how to fit _correctly_ an histogram ? Date: Thu, 22 Jan 2009 03:18:21 +0800 User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

```Hello List,

I have a collection of histograms got from simulations to fit.
I want to perform nonlinear least-squares fits.

My concern is rather how to parametrise in a relevant way the a priori model
function of my choice, and how to extract in a pertinent way the information
from the histogram.

First, let say that the model function is a Gaussian:
g0(x;sigma)=exp(-x^2/sigma^2/2)/(sqrt(2Pi)*sigma))
Of course my histogram may be not centered, so beside
the scale sigma, a shift xi may be considered.
The model function then becomes
g1(x;xi,sigma)=exp(-(x-xi)^2/sigma^2/2)/(sqrt(2Pi)*sigma)=g0(x-xi;sigma).
```
Following the same idea, a coefficient Alpha may be introduced: g2(x;Alpha,xi,sigma)=Alpha*g1(x;xi,sigma)=Alpha*g0(x-xi;sigma).
```
Second, what about the observed value G_i for the ith bin centered at x_i ?
G_i=(width of the bin)*(number of element inside the bin)/(sum over the bins of
G_i)

Finally, the function component to implement to feed GSL (section 37.1) may
write:
f_i=(G_i-g2(x_i;Alpha,xi,sigma)*(with of the bin))/(weight_i)
[by the way, how to get meaning full weight_i ?].

My questions are quite naive, but so far, I have found no totally satisfying
By googling I have found a lot of fuzzy how to, but no explicit one:
does any know where a fully histogram least-squares fit example can be found
in literature or/and on the web ?

Jerome

--
Jerome BENOIT
jgmbenoit_at_mailsnare_dot_net

```