net.sf.jaer.util
Class RollingLinearRegression
java.lang.Object
net.sf.jaer.util.RollingLinearRegression
public class RollingLinearRegression
- extends java.lang.Object
Does a moving or rolling linear regression (a linear fit) on updated data.
The new data point replaces the oldest data point. Summary statistics holds the rollling values
and are updated by subtracting the oldest point and adding the newest one.
From Wikipedia article on Ordinary least squares.
- Author:
- tobi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LENGTH_DEFAULT
public static final int LENGTH_DEFAULT
- See Also:
- Constant Field Values
RollingLinearRegression
public RollingLinearRegression()
- Creates a new instance of RollingLinearRegression
addPoint
public void addPoint(java.awt.geom.Point2D.Float p)
- Adds a new point.
- Parameters:
p
- the point
getLength
public int getLength()
setLength
public void setLength(int length)
- Sets the window length. Clears the accumulated data.
- Parameters:
length
- the number of points to fit- See Also:
LENGTH_DEFAULT
getPoints
public java.util.LinkedList<java.awt.geom.Point2D.Float> getPoints()
getIntercept
public float getIntercept()
getSlope
public float getSlope()
main
public static void main(java.lang.String[] args)