/** * 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); }
/** * 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()); }