How to use WeightedRegression


Hi! I’m new to Math.NET.
I need to use WeightedRegression.Weighted() but I don’t know how to build the Predictor matrix X.
What I have is:
double[] xData
double[] yData
double[] weights (one weight factor per x value)
int order (order of polynomial fit)

From weights, I built a diagonal matrix using Matrix.Build.DenseOfDiagonalArray(weights).
How can I set the order of the polynomial fit?
What is returned by the Weighted() function?
I just want to do a weighted polynomial fit of my values.
Pls help :slight_smile:


It is solved, there is double[] PolynomialWeighted(double[] x, double[] y, double[] w, int order);