
public class SimpleLinearRegression extends Object
| Modifier and Type | Field and Description |
|---|---|
private org.apache.commons.math3.stat.regression.SimpleRegression |
regression |
| Constructor and Description |
|---|
SimpleLinearRegression()
Create an empty SimpleLinearRegression instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addData(double x,
double y)
Adds the observation (x,y) to the regression data set.
|
double |
getIntercept()
Returns the intercept of the estimated regression line.
|
double |
getInterceptStdErr()
Returns the
standard error of the intercept estimate, usually denoted s(b0).
|
long |
getN()
Returns the number of observations that have been added to the model.
|
double |
getR()
Returns Pearson's product moment correlation
coefficient, usually denoted r.
|
double |
getSlope()
Returns the slope of the estimated regression line.
|
double |
getSlopeStdErr()
Returns the standard error of the slope estimate.
|
double |
predict(double x)
Returns the "predicted"
y value associated with the supplied
x value, based on the data that has been added to the model when this method is activated. |
void |
removeData(double x,
double y)
Removes the observation (x,y) from the regression data set, mirroring the addData method.
|
String |
toString() |
private org.apache.commons.math3.stat.regression.SimpleRegression regression
public SimpleLinearRegression()
public final void addData(double x,
double y)
x - independent variable valuey - dependent variable valuepublic final void removeData(double x,
double y)
x - independent variable valuey - dependent variable valuepublic final double getSlope()
Double,NaN is returned.public final double getIntercept()
Double,NaN is returned.public final long getN()
public final double predict(double x)
y value associated with the supplied
x value, based on the data that has been added to the model when this method is activated.
predict(x) = intercept + slope * x
Double,NaN is returned.x - input x valuey valuepublic final double getR()
Double,NaN is returned.
public final double getInterceptStdErr()
Double.NaN.public final double getSlopeStdErr()
Double.NaN.Copyright © 2015 University of Glasgow. All rights reserved.