Class LinTrendAccumulator

  • public final class LinTrendAccumulator
    extends java.lang.Object
    Maintains the components needed to compute the linear regression on a set of (long, long) pairs. The intermediate results are held in the form of BigInteger and the finished value is a double-valued linear coefficient.
    Jet 3.0
    • Constructor Detail

      • LinTrendAccumulator

        public LinTrendAccumulator()
        Constructs a new accumulator with all components at zero.
      • LinTrendAccumulator

        public LinTrendAccumulator​(long n,
                                   java.math.BigInteger sumX,
                                   java.math.BigInteger sumY,
                                   java.math.BigInteger sumXY,
                                   java.math.BigInteger sumX2)
        Creates a new accumulator with the given components. Intended only for testing and deserialization.
    • Method Detail

      • accumulate

        public LinTrendAccumulator accumulate​(long x,
                                              long y)
        Accumulates a new sample.
      • export

        public double export()
        Computes the linear coefficient of the linear regression of the accumulated samples.
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • writeObject

        public void writeObject​(ObjectDataOutput out)
        Serializes this accumulator.