Regression Analysis Utility
.NET 8.0
Algebra
DoubleDouble
static ddouble f(ddouble x, ddouble y) {
return 0.5 + 0.25 * x + 0.125 * y + 0.0625 * x * y + 2 * x * x + 4 * y * y;
}
(Vector x, Vector y) = Vector.MeshGrid(new ddouble[] { 0, 1, 2, 3, 4 }, new ddouble[] { 1, 2, 3, 4 });
Vector z = (f, (x, y));
// outlier
z[12] = 800;
RobustRegressor fitter = new([x, y, x * y, x * x, y * y], z);
Vector param = fitter.Fit();