Package math
Class Regress
- java.lang.Object
-
- math.Regress
-
public class Regress extends java.lang.Object
Class
Regress
estimates a regression coefficient.Instances of class
Regress
are not thread-safe, but concurrent updates are permitted, and invocation of thebeta()
method in the absence of concurrent updates returns an accurate result.
-
-
Constructor Summary
Constructors Constructor Description Regress()
Constructs a newRegress
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double x, double y)
Records the specified values of the dependent and independent variables.double
beta()
Returns the regression coefficient for the recorded values of the independent and dependent variables.long
cnt()
Returns the number of recorded values of the independent variable.static void
main(java.lang.String[] args)
-
-
-
Method Detail
-
add
public void add(double x, double y)
Records the specified values of the dependent and independent variables.- Parameters:
x
- the value of the independent variabley
- the value of the dependent variable
-
cnt
public long cnt()
Returns the number of recorded values of the independent variable. The returned value is NOT an atomic snapshot. An accurate result is guaranteed only if no concurrent updates occur during method invocation.- Returns:
- the number of recorded values of the independent variable
-
beta
public double beta()
Returns the regression coefficient for the recorded values of the independent and dependent variables. The returned value is NOT an atomic snapshot. An accurate result is guaranteed only if no concurrent updates occur during method invocation.- Returns:
- the regression coefficient for the recorded values of the independent and dependent variables
-
main
public static void main(java.lang.String[] args)
-
-