/** * Adds an observation to the regression model. * @param x the array with regressor values * @param y the value of dependent variable given these regressors * @exception ModelSpecificationException if the length of {@code x} does not equal * the number of independent variables in the model */ public void addObservation(final double[] x, final double y) throws ModelSpecificationException { if ((!this.hasIntercept && x.length != nvars) || (this.hasIntercept && x.length + 1 != nvars)) { throw new ModelSpecificationException(LocalizedFormats.INVALID_REGRESSION_OBSERVATION, x.length, nvars); } if (!this.hasIntercept) { include(MathArrays.copyOf(x, x.length), 1.0, y); } else { final double[] tmp = new double[x.length + 1]; System.arraycopy(x, 0, tmp, 1, x.length); tmp[0] = 1.0; include(tmp, 1.0, y); } ++nobs; }
d[col] = 0.0; rhs[col] = 0.0; this.include(x_sing, weight, y); } else { sserr += d[col] * rhs[col] * rhs[col];
d[col] = 0.0; rhs[col] = 0.0; this.include(x_sing, weight, y); } else { sserr += d[col] * rhs[col] * rhs[col];
/** * Adds an observation to the regression model. * @param x the array with regressor values * @param y the value of dependent variable given these regressors * @exception ModelSpecificationException if the length of {@code x} does not equal * the number of independent variables in the model */ public void addObservation(final double[] x, final double y) throws ModelSpecificationException { if ((!this.hasIntercept && x.length != nvars) || (this.hasIntercept && x.length + 1 != nvars)) { throw new ModelSpecificationException(LocalizedFormats.INVALID_REGRESSION_OBSERVATION, x.length, nvars); } if (!this.hasIntercept) { include(MathArrays.copyOf(x, x.length), 1.0, y); } else { final double[] tmp = new double[x.length + 1]; System.arraycopy(x, 0, tmp, 1, x.length); tmp[0] = 1.0; include(tmp, 1.0, y); } ++nobs; }
/** * Adds an observation to the regression model. * @param x the array with regressor values * @param y the value of dependent variable given these regressors * @exception ModelSpecificationException if the length of {@code x} does not equal * the number of independent variables in the model */ public void addObservation(final double[] x, final double y) throws ModelSpecificationException { if ((!this.hasIntercept && x.length != nvars) || (this.hasIntercept && x.length + 1 != nvars)) { throw new ModelSpecificationException(LocalizedFormats.INVALID_REGRESSION_OBSERVATION, x.length, nvars); } if (!this.hasIntercept) { include(MathArrays.copyOf(x, x.length), 1.0, y); } else { final double[] tmp = new double[x.length + 1]; System.arraycopy(x, 0, tmp, 1, x.length); tmp[0] = 1.0; include(tmp, 1.0, y); } ++nobs; }
d[col] = 0.0; rhs[col] = 0.0; this.include(x_sing, weight, y); } else { sserr += d[col] * rhs[col] * rhs[col];