Package maths_fns :: Module chi2
[hide private]
[frames] | no frames]

Module chi2

source code

Functions [hide private]
 
chi2(data, back_calc_vals, errors)
Function to calculate the chi-squared value.
source code
 
dchi2(data, back_calc_vals, back_calc_grad, errors)
Function to create the chi-squared gradient.
source code
 
d2chi2(data, back_calc_vals, back_calc_grad_j, back_calc_grad_k, back_calc_hess, errors)
Function to create the chi-squared Hessian.
source code

Imports: Float64, sum, transpose, zeros


Function Details [hide private]

chi2(data, back_calc_vals, errors)

source code 
Function to calculate the chi-squared value.

The chi-sqared equation
~~~~~~~~~~~~~~~~~~~~~~~
        _n_
        \    (yi - yi()) ** 2
Chi2  =  >   ----------------
        /__    sigma_i ** 2
        i=1

where:
    yi are the values of the measured data set.
    yi() are the values of the back calculated data set.
    sigma_i are the values of the error set.

The chi-squared value is returned.

dchi2(data, back_calc_vals, back_calc_grad, errors)

source code 
Function to create the chi-squared gradient.

The chi-sqared gradient
~~~~~~~~~~~~~~~~~~~~~~~
               _n_
 dChi2         \   /  yi - yi()      dyi()  \ 
-------  =  -2  >  | ----------  .  ------- |
dthetaj        /__ \ sigma_i**2     dthetaj /
               i=1

where:
    yi are the values of the measured data set.
    yi() are the values of the back calculated data set.
    sigma_i are the values of the error set.

The chi-squared gradient vector is returned.

d2chi2(data, back_calc_vals, back_calc_grad_j, back_calc_grad_k, back_calc_hess, errors)

source code 
Function to create the chi-squared Hessian.

The chi-squared Hessian
~~~~~~~~~~~~~~~~~~~~~~~
                      _n_
     d2chi2           \       1      /  dyi()     dyi()                         d2yi()     \ 
---------------  =  2  >  ---------- | ------- . -------  -  (yi - yi()) . --------------- |
dthetaj.dthetak       /__ sigma_i**2 \ dthetaj   dthetak                   dthetaj.dthetak /
                      i=1

where:
    yi are the values of the measured relaxation data set.
    yi() are the values of the back calculated relaxation data set.
    sigma_i are the values of the error set.