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.
    Since:
    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)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public void writeObject​(ObjectDataOutput out)
                         throws java.io.IOException
        Serializes this accumulator.
        Throws:
        java.io.IOException