Package math

Class Regress


  • public class Regress
    extends java.lang.Object

    Class Regress estimates a regression coefficient.

    Instances of class Regress are not thread-safe, but concurrent updates are permitted, and invocation of the beta() method in the absence of concurrent updates returns an accurate result.

    • Constructor Summary

      Constructors 
      Constructor Description
      Regress()
      Constructs a new Regress instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(double x, double y)
      Records the specified values of the dependent and independent variables.
      double beta()
      Returns the regression coefficient for the recorded values of the independent and dependent variables.
      long cnt()
      Returns the number of recorded values of the independent variable.
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Regress

        public Regress()
        Constructs a new Regress instance.
    • Method Detail

      • add

        public void add​(double x,
                        double y)
        Records the specified values of the dependent and independent variables.
        Parameters:
        x - the value of the independent variable
        y - the value of the dependent variable
      • cnt

        public long cnt()
        Returns the number of recorded values of the independent variable. The returned value is NOT an atomic snapshot. An accurate result is guaranteed only if no concurrent updates occur during method invocation.
        Returns:
        the number of recorded values of the independent variable
      • beta

        public double beta()
        Returns the regression coefficient for the recorded values of the independent and dependent variables. The returned value is NOT an atomic snapshot. An accurate result is guaranteed only if no concurrent updates occur during method invocation.
        Returns:
        the regression coefficient for the recorded values of the independent and dependent variables
      • main

        public static void main​(java.lang.String[] args)