Chi-square and weights

Syntax: | `FIT\WEIGHTS w y=expression FIT\WEIGHTS\-ZEROS w y=expression FIT\WEIGHTS\TOLERANCE w eps y=expression FIT\WEIGHTS\ITMAX w n y=expression FIT\WEIGHTS\ITMAX\TOLERANCE w n eps y=expression FIT\WEIGHTS\-ZEROS\ITMAX w n y=expression`

The weight at each point defaults to one (`1`), if a weight vector is not entered. Weights only make sense with a normal distribution, and are ignored when used with the `\POISSON` qualifier.

To make use of a weight array, the `\WEIGHTS` qualifier must be entered. If the `\WEIGHTS` qualifier is used, the weight vector, `w`, will then be expected. The weights are assigned to the dependent variable in a one-to-one fashion, that is, the weight vector must be the same length as the data vector, `y`. If the `\ITMAX` qualifier is used, the weight comes before the iteration maximum in the command parameter list. If the `\TOLERANCE` qualifier is used, the iteration maximum comes before the tolerance in the command parameter list.

By default, the zero elements of the weight vector are used when calculating the number of degrees of freedom. If the `\-ZEROS` qualifier is used with the `\WEIGHTS` qualifier, then the zero elements of the weight vector will not be used when calculating the number of degrees of freedom. This could have an affect on the calculation of the confidence level, the `χ2` per degrees of freedom, and `E2`, the root mean square total errors of estimate.

If the `\CHISQ` qualifier is used, a new scalar, named `FIT$CHISQ`, will be made with value equal to the total

`χ2 = ∑ wk[yk - f(xk,pmin)]2`

where `wk` represents the optional weight at each data point `yk`, f is the expression to be fitted, and `pmin` are the best values of the parameters, `p`.

Normal distribution
Hint for physicists