public static void CalculatePRESS( IROMatrix matrixX, IROMatrix xLoads, IROMatrix yLoads, IROMatrix xScores, IROVector crossProduct, int numberOfFactors, out IROVector PRESS) { IMatrix predictedY = new JaggedArrayMatrix(yLoads.Rows, yLoads.Columns); IVector press = VectorMath.CreateExtensibleVector(numberOfFactors + 1); PRESS = press; press[0] = MatrixMath.SumOfSquares(yLoads); for (int nf = 0; nf < numberOfFactors; nf++) { Predict(matrixX, xLoads, yLoads, xScores, crossProduct, nf, predictedY, null); press[nf + 1] = MatrixMath.SumOfSquaredDifferences(yLoads, predictedY); } }
public static void CalculatePRESS( IROMatrix <double> matrixX, IROMatrix <double> xLoads, IROMatrix <double> yLoads, IROMatrix <double> xScores, IReadOnlyList <double> crossProduct, int numberOfFactors, out IROVector <double> PRESS) { IMatrix <double> predictedY = new JaggedArrayMatrix(yLoads.RowCount, yLoads.ColumnCount); var press = VectorMath.CreateExtensibleVector <double>(numberOfFactors + 1); PRESS = press; press[0] = MatrixMath.SumOfSquares(yLoads); for (int nf = 0; nf < numberOfFactors; nf++) { Predict(matrixX, xLoads, yLoads, xScores, crossProduct, nf, predictedY, null); press[nf + 1] = MatrixMath.SumOfSquaredDifferences(yLoads, predictedY); } }