使用Math.NET计算多个回归残差

时间:2019-12-10 02:03:54

标签: c# math.net

如何通过多重回归计算残差?

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);

1 个答案:

答案 0 :(得分:0)

    Vector<double> R = MultipleRegression.NormalEquations(X, Y);

    //Calculate estimates
    Vector<double> E = X * R;

    // Calculate residuals
    Vector<double> Res = Y - E;
相关问题