coefficients method

Array coefficients()

return the coefficients of the polynomial regression p(x) = p0 * x**deg + ... + p[deg]

Implementation

Array coefficients() {
  var coeff = Array.empty();
  var j = beta.row - 1;

  // ignoring leading zero coefficients
  while (j >= 0 && beta[j][0].abs() < 1E-5) {
    j--;
  }

  // create remaining terms
  while (j >= 0) {
    coeff.add(beta[j][0]);
    j--;
  }

  return coeff;
}