This project has moved. For the latest updates, please go here.

Multiple Regression with multiple X array variables

Jan 8, 2014 at 6:43 AM
Hello there!

Please help me use Math.Net multi-regression functions. I am working with the following code:

var xdata = new double[,]{ {1, 36, 66, 45, 32}, {1, 37, 68, 12, 2}, {1, 47, 64, 78, 34}, {1, 32, 53, 56, 32}, {1, 1, 101, 24, 90}};
var X = DenseMatrix.CreateFromColumns(new[] { new DenseVector(xdata.Length, 1), new DenseVector(xdata) });
var ydata = new double[] { 15, 20, 25, 55, 95 };
var y = new DenseVector(ydata);
var p = X.QR().Solve(y);

The problem I encounter is with "new DenseVector(xdata)" which I think does not accommodate Multidimensional Array parameter.

Please help me obtain the values for Intercept and Slopes or X coefficients.

Thank you in advance for any advise you will give.

Regards,
Marlon