/** * Compute the value of the linear equation at the current point * @param point point at which linear equation must be evaluated * @return value of the linear equation at the current point */ public double getValue(final double[] point) { return coefficients.dotProduct(point) + constantTerm; }
/** * Compute the value of the linear equation at the current point * @param point point at which linear equation must be evaluated * @return value of the linear equation at the current point */ public double getValue(final double[] point) { return coefficients.dotProduct(point) + constantTerm; }
/** * Compute the value of the linear equation at the current point * @param point point at which linear equation must be evaluated * @return value of the linear equation at the current point */ public double getValue(final RealVector point) { return coefficients.dotProduct(point) + constantTerm; }
/** * Compute the value of the linear equation at the current point * @param point point at which linear equation must be evaluated * @return value of the linear equation at the current point */ public double getValue(final RealVector point) { return coefficients.dotProduct(point) + constantTerm; }
/** * Returns the sum of squared residuals. * * @return residual sum of squares * @since 2.2 */ public double calculateResidualSumOfSquares() { final RealVector residuals = calculateResiduals(); return residuals.dotProduct(residuals); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) { return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** * Compute the cosine of the angle between 2 vectors. * * @param v Vector. * @param w Vector. * @return cosine of the angle */ private double cosAngle(final RealVector v, final RealVector w) { return v.dotProduct(w) / (v.getNorm() * w.getNorm()); }
/** * Compute the cosine of the angle between 2 vectors. * * @param v Vector. * @param w Vector. * @return cosine of the angle */ private double cosAngle(final RealVector v, final RealVector w) { return v.dotProduct(w) / (v.getNorm() * w.getNorm()); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) { return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** * <p>Calculates the variance on the Y by OLS. * </p> * <p> Var(y) = Tr(u<sup>T</sup>u)/(n - k) * </p> * @return The Y variance */ @Override protected double calculateYVariance() { RealVector residuals = calculateResiduals(); return residuals.dotProduct(residuals) / (X.getRowDimension() - X.getColumnDimension()); }
/** * <p>Calculates the variance of the error term.</p> * Uses the formula <pre> * var(u) = u · u / (n - k) * </pre> * where n and k are the row and column dimensions of the design * matrix X. * * @return error variance estimate * @since 2.2 */ protected double calculateErrorVariance() { RealVector residuals = calculateResiduals(); return residuals.dotProduct(residuals) / (X.getRowDimension() - X.getColumnDimension()); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) throws IllegalArgumentException { checkVectorDimensions(v.getDimension()); return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** {@inheritDoc} */ public RealVector projection(RealVector v) throws IllegalArgumentException { checkVectorDimensions(v.getDimension()); return v.mapMultiply(dotProduct(v) / v.dotProduct(v)); }
/** * Calculates the variance on the y by GLS. * <pre> * Var(y)=Tr(u' Omega^-1 u)/(n-k) * </pre> * @return The Y variance */ @Override protected double calculateYVariance() { RealVector residuals = calculateResiduals(); double t = residuals.dotProduct(getOmegaInverse().operate(residuals)); return t / (X.getRowDimension() - X.getColumnDimension()); }
/** * Calculates the estimated variance of the error term using the formula * <pre> * Var(u) = Tr(u' Omega^-1 u)/(n-k) * </pre> * where n and k are the row and column dimensions of the design * matrix X. * * @return error variance * @since 2.2 */ @Override protected double calculateErrorVariance() { RealVector residuals = calculateResiduals(); double t = residuals.dotProduct(getOmegaInverse().operate(residuals)); return t / (X.getRowDimension() - X.getColumnDimension()); }
double product=matrix.operate(cachedV.getColumnVector(i)).dotProduct(tmp); if (product<0) { cachedU.setColumnVector(i, tmp.mapMultiply(-1.0));
double product=matrix.operate(cachedV.getColumnVector(i)).dotProduct(tmp); if (product<0) { cachedU.setColumnVector(i, tmp.mapMultiply(-1.0));