|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.gen.LinearRegression
For calculating a simple linear regression. Adapted from http://www-stat.stanford.edu/~naras/java/course/lec2/ Balasubramanian Narasimhan, Stanford
Constructor Summary | |
LinearRegression(double[] x,
double[] y)
|
Method Summary | |
double |
calculateX(double y)
Calculate X given Y. |
double |
calculateY(double x)
Calculate Y given X. |
double |
getIntercept()
|
java.lang.String |
getModel()
Returns Y=mX+b with full precision, no rounding of numbers. |
java.lang.String |
getRoundedModel()
Returns Y=mX+b |
double |
getRSquared()
|
double |
getSlope()
|
double[] |
getX()
|
static double |
interpolateX(double x1,
double y1,
double x2,
double y2,
double fixedY)
Return approximated X value, good for a single interpolation, multiple calls are inefficient! |
static double |
interpolateY(double x1,
double y1,
double x2,
double y2,
double fixedX)
Return approximated Y value, good for a single interpolation, multiple calls are inefficient! |
static void |
main(java.lang.String[] args)
An example. |
void |
nullArrays()
Nulls the x and y arrays. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LinearRegression(double[] x, double[] y)
Method Detail |
public static void main(java.lang.String[] args)
public static double interpolateY(double x1, double y1, double x2, double y2, double fixedX)
public static double interpolateX(double x1, double y1, double x2, double y2, double fixedY)
public double getSlope()
public double getIntercept()
public double getRSquared()
public double[] getX()
public java.lang.String getModel()
public java.lang.String getRoundedModel()
public double calculateY(double x)
public double calculateX(double y)
public void nullArrays()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |