class LeastSquaresRegressionResult {

  public double getPredictedValue(final double[] x) {
    Validate.notNull(x, "x");
    final double[] betas = getBetas();
    if (hasIntercept()) {
      if (x.length != betas.length - 1) {
        throw new IllegalArgumentException("Number of variables did not match number used in regression");
      }
    } else {
      if (x.length != betas.length) {
        throw new IllegalArgumentException("Number of variables did not match number used in regression");
      }
    }
    double sum = 0;
    for (int i = 0; i < (hasIntercept() ? x.length + 1 : x.length); i++) {
      if (hasIntercept()) {
        if (i == 0) {
          sum += betas[0];
        } else {
          sum += betas[i] * x[i - 1];
        }
      } else {
        sum += x[i] * betas[i];
      }
    }
    return sum;
  }

  public  LeastSquaresRegressionResult(final LeastSquaresRegressionResult result);
  public  LeastSquaresRegressionResult(final double[] betas, final double[] residuals, final double meanSquareError, final double[] standardErrorOfBeta, final double rSquared,
      final double rSquaredAdjusted, final double[] tStats, final double[] pValues, final boolean hasIntercept);

}