[chisq, NData, NPars, chisqDataPoints, chisqConstraints, residuals] = ...
         pwGetChisqAndN(iCouple, iStimulus)

 Returns the chi-square value and number of data points for
 a given combined couple and stimulus of the last fit. If no couple is
 specified, the total chi-square value is calculated.



 The chi-square value is the sum over the squared residuals
 between model and data. Each residual is weighted with 1/standard deviation
 (if weights are not changed by the user).
 If the model(s) contain constraints, the chisq value is increased by
 chisqConstraints. Use chisqDataPoints if you are interested in only
 the chisq value based on the data points.

 Returns also the number of fitted parameters.

 NData may be smaller than the number of residuals belonging to the model
 data distance, since NaN values in the data lead to a 0 residual and
 are not counted by NData.

See also