2

Is there a function inside MathNet.Numerics to calculate regression slope error?

        double[] xdata = new double[] { 10, 20, 30 };
        double[] ydata = new double[] { 15, 20, 25 };

        Tuple<double, double> p = MathNet.Numerics.Fit.Line(xdata, ydata);
        double a = p.Item1; // == 10; intercept
        double b = p.Item2; // == 0.5; slope

The above gives the slope. How does one get the error of the slope?

Thanks

Matt Burland
  • 44,552
  • 18
  • 99
  • 171
user1234440
  • 22,521
  • 18
  • 61
  • 103

1 Answers1

2

The GoodnessOfFit class has R and RSquared methods on it

An example of usage taken from the website

GoodnessOfFit.RSquared(xdata.Select(x => a+b*x), ydata); // == 1.0

Your sample code comes from the same page.

Steve Mitcham
  • 5,268
  • 1
  • 28
  • 56