如何通过多重回归计算残差?
double[] y = {56, 65, 34, 65, 75, ...};
double[][] x = {
new[] {48, 25, 4.6, ...},
new[] {45, 34, 2.1, ...},
...
};
DenseMatrix X = DenseMatrix.OfRowArrays(x);
DenseVector Y = DenseVector.OfArray(y);
Vector<double> R = MultipleRegression.NormalEquations(X, Y);
答案 0 :(得分:0)
Vector<double> R = MultipleRegression.NormalEquations(X, Y);
//Calculate estimates
Vector<double> E = X * R;
// Calculate residuals
Vector<double> Res = Y - E;