aboutsummaryrefslogtreecommitdiff
path: root/math/bevington/man/chifit.3m
blob: ec8f7f2c85e88443eb466da5903b011746318854 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
.TH CHIFIT 3M
.SH NAME
chifit
.SH DESCRIPTION
subroutine chifit.f 

source
  Bevington, pages 228-231.

purpose
  make least-squares fit to a non-linear function
    with a parabolic expansion of chi square 

usage 
  call chifit (x, y, sigmay, npts, nterms, mode, a, deltaa,
    sigmaa, yfit, chisqr)

description of parameters
  x      - array of data points for independent variable
  y      - array of data points for dependent variable
  sigmay - array of standard deviations for y data points
  npts   - number of pairs of data points
  nterms - number of parameters
  mode   - determines method of weighting least-squares fit
           +1 (instrumental) weight(i) = 1./sigmay(i)**2
            0 (no weighting) weight(i) = 1.
           -1 (statistical)  weight(i) = 1./y(i)
  a      - array of parameters
  deltaa - array of increments for parameters a
  sigmaa - array of standard deviations for parameters a
  yfit   - array of calculated values of y
  chisqr - reduced chi square for fit 

subroutines and function subprograms required 
  functn (x, i, a)
    evaluates the fitting function for the ith term
  fchisq (y, sigmay, npts, nfree, mode, yfit) 
    evaluates reduced chi squared for fit to data
  matinv (array, nterms, det) 
    inverts symmetric two-dimension matrix of degree nterms
      and calculates its determinant

comments
  valid for nterms up to 10