/// @return double contribution to chi^2 sum against /// a theoretical function /// @param wp WeightedPoint public double Chi2Contribution(WeightedPoint wp) { double residue = _yValue - wp.YValue; return residue * residue / (1 / wp.Weight + 1 / _weight); }
/// @param pdf DhbStatistics.ScaledProbabilityDensityFunction /// @return double chi2 of histogram compared to supplied /// probability distribution. public double Chi2Against(ScaledProbabilityDensityFunction pdf) { double chi2 = 0; for (int i = 0; i < _contents.Length; i++) chi2 += new WeightedPoint(1, _contents[i]).Chi2Contribution(pdf); return chi2; }