Class LinearRegression

java.lang.Object
org.episteme.core.mathematics.statistics.fitting.LinearRegression

public class LinearRegression extends Object
Linear regression: y = a + b*x (least squares).
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • fit

      public static LinearRegression fit(double[] x, double[] y)
      Fits a linear model to the data.
      Parameters:
      x - Independent variable values
      y - Dependent variable values
      Returns:
      LinearRegression model
    • fit

      public static LinearRegression fit(Real[] x, Real[] y)
      Fits linear model using Real types.
    • predict

      public double predict(double x)
      Predicts y for given x.
    • predict

      public Real predict(Real x)
    • getSlope

      public double getSlope()
    • getIntercept

      public double getIntercept()
    • getRSquared

      public double getRSquared()
    • getStandardError

      public double getStandardError()
    • getSampleSize

      public int getSampleSize()
    • toString

      public String toString()
      Overrides:
      toString in class Object