edu.mit.sketch.util
Class OrthogonalDistanceRegression

java.lang.Object
  |
  +--edu.mit.sketch.util.OrthogonalDistanceRegression

public class OrthogonalDistanceRegression
extends Object


Constructor Summary
OrthogonalDistanceRegression()
           
 
Method Summary
static double[] deriveDirectionUsingRotationalSWODR(Point[] points, int window_span)
          Derive direction, and fill in the d array.
static double[] deriveDirectionUsingRotationalSWODRFast(Point[] points, int window_span)
          Derive direction, and fill in the d array.
static double[] doODR(String parameters_file_name, String results_file_name, double[] x, double[] y)
          Do an ODR using the inputs x and y, and return a double array of length 2 containing a and b, st.
static double[][] doSlidingWindowODR(String parameters_file_name, String results_file_name, double[] x, double[] y, int window_span)
          Do an ODR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrthogonalDistanceRegression

public OrthogonalDistanceRegression()
Method Detail

doODR

public static double[] doODR(String parameters_file_name,
                             String results_file_name,
                             double[] x,
                             double[] y)
Do an ODR using the inputs x and y, and return a double array of length 2 containing a and b, st. the line fitted is represented by ax+b.

doSlidingWindowODR

public static double[][] doSlidingWindowODR(String parameters_file_name,
                                            String results_file_name,
                                            double[] x,
                                            double[] y,
                                            int window_span)
Do an ODR. x contains the x positions, y contains the y positions, and window_span determines how many elements are considered at a time. window_span should be an odd integer. The sliding window contains a total of window_span points, n on the left of the current point, n on the right of the current point, and 1 the current point where n = (window_span-1)/2. The regression for the first and the last n points are done using a simpler method. This method returns a two dimensional array of doubles whose length is equal to the length of the input arrays. So the first index indices the points. The second one indices a and b (ie. the slope and the y intercept of the fitted line).

deriveDirectionUsingRotationalSWODR

public static double[] deriveDirectionUsingRotationalSWODR(Point[] points,
                                                           int window_span)
Derive direction, and fill in the d array. This method is different than the previous one in that here we look at a collection of points rather than two points to come up with the direction.

deriveDirectionUsingRotationalSWODRFast

public static double[] deriveDirectionUsingRotationalSWODRFast(Point[] points,
                                                               int window_span)
Derive direction, and fill in the d array. This method is different than the previous one in that here we look at a collection of points rather than two points to come up with the direction.