|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Linear
public class Linear
Contains methods related to determining the linear linear relationship between two datasets (of equal arrays) such as the best-fit linear line parameters, box-cox transformations, etc.
Nested Class Summary | |
---|---|
static class |
Linear.BoxCox
Contains methods related to the Box-Cox transformation of a data set; useful in determining the best transformation that will yield the best method for converting a monotonic, non-linear relationship between x and y into
a linear one. |
static class |
Linear.Significance
Contains methods used to compute the significance, or pvalue of the input correlations. |
static class |
Linear.StdErr
Contains methods related to computing the standard errors of the residuals, slope and intercept associated with the best-fit linear line. |
Field Summary |
---|
Fields inherited from interface papaya.PapayaConstants |
---|
BASELINE, big, biginv, BOTTOM, CENTER, CORNER, FONTNAME, GRAY, INDEX_NOT_FOUND, INDICES_NOT_FOUND, LEFT, LOGPI, MACHEP, MAXGAM, MAXLOG, MINLOG, RIGHT, SQRTH, SQTPI, STROKEWEIGHT, TEXTSIZE, TOP |
Constructor Summary | |
---|---|
Linear()
|
Method Summary | |
---|---|
static float[] |
bestFit(float[] x,
float[] y)
Returns the slope and y-intercept of the best fit linear line z = slope*x + intercept by minimizing the sum of least squares
between z and the y . |
static float |
bestFit(float[] x,
float[] y,
float intercept)
Returns the slope of the best fit linear line for the prescribed y-intercept. |
static float[] |
residuals(float[] x,
float[] y)
Compute and return the array of residuals given by Delta_i = z_i - y_i ,
where
z_i = (slope*x_i + intercept) is the best fit linear line. |
static float[] |
residuals(float[] x,
float[] y,
float slope,
float intercept)
Compute and return the array of residuals given by Delta_i = z_i - y_i ,
where
z_i = (slope*x_i + intercept) is the best fit linear line. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Linear()
Method Detail |
---|
public static float[] bestFit(float[] x, float[] y)
z = slope*x + intercept
by minimizing the sum of least squares
between z
and the y
.
x
- the x datay
- the y data
coeff[0]
corresponding to
the slope, and the second element coeff[1]
equal to the y-intercept.public static float bestFit(float[] x, float[] y, float intercept)
z = slope*x + intercept
, where the intercept is specified
by the user. E.g. intercept = 1
will result in z = slope*x+1
.
The slope
is computed by minimizing the sum of least squares
between z
and the y
.
x
- the x datay
- the y dataintercept
- the intercept of the best-fit line with the y-axis.
public static float[] residuals(float[] x, float[] y, float slope, float intercept)
Delta_i = z_i - y_i
,
where
z_i = (slope*x_i + intercept)
is the best fit linear line.
slope
- the slope of the best-fit linear lineintercept
- the y-intercept of the best fit linear linepublic static float[] residuals(float[] x, float[] y)
Delta_i = z_i - y_i
,
where
z_i = (slope*x_i + intercept)
is the best fit linear line.
You'd basically use this to compute the spread of a best fit line (max - min)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |