chi2 method

double chi2 (List<double> params)

Implementation

double chi2(List<double> params) {
  double chi2 = 0.0, obs, exp, w;

  for (int i = 0; i < xvals.length; i++) {
    exp = model(xvals[i], params);
    obs = yvals[i];
    w = weights[i];
    chi2 += math.pow((obs - exp), 2) / math.pow(w, 2);
  }
  return chi2;
}