public class RegressionResults extends Object implements Serializable
Constructor and Description |
---|
RegressionResults(double[] parametersIn,
double[][] varcov,
boolean isSymmetricCompressed,
long nobsIn,
int rankIn,
double sumy,
double sumysq,
double sse,
boolean containsConstantIn,
boolean copyData)
Constructor for Regression Results.
|
Modifier and Type | Method and Description |
---|---|
double |
getAdjustedRSquared()
Returns the adjusted R-squared statistic, defined by the formula
R2adj = 1 - [SSR (n - 1)] / [SSTO (n - p)]
where SSR is the sum of squared residuals}, SSTO is the total sum of squares}, n is the number of observations
and p is the number of parameters estimated (including the intercept).
|
double |
getCovarianceOfParameters(int i,
int j)
Returns the covariance between regression parameters i and j.
|
double |
getErrorSumSquares()
Returns the sum of squared errors (SSE) associated with the
regression model.
|
double |
getMeanSquareError()
Returns the sum of squared errors divided by the degrees of freedom, usually abbreviated MSE.
|
long |
getN()
Returns the number of observations added to the regression model.
|
int |
getNumberOfParameters()
Returns the number of parameters estimated in the model.
|
double |
getParameterEstimate(int index)
Returns the parameter estimate for the regressor at the given index.
|
double[] |
getParameterEstimates()
Returns a copy of the regression parameters estimates.
|
double |
getRegressionSumSquares()
Returns the sum of squared deviations of the predicted y values about their mean (which equals the mean of y).
|
double |
getRSquared()
Returns the coefficient of multiple determination, usually
denoted r-square.
|
double |
getStdErrorOfEstimate(int index)
Returns the standard
error of the parameter estimate at index,
usually denoted s(bindex).
|
double[] |
getStdErrorOfEstimates()
Returns the standard error of the parameter estimates,
usually denoted s(bi).
|
double |
getTotalSumSquares()
Returns the sum of squared deviations of the y values about their mean.
|
boolean |
hasIntercept()
Returns true if the regression model has been computed including an intercept.
|
public RegressionResults(double[] parametersIn, double[][] varcov, boolean isSymmetricCompressed, long nobsIn, int rankIn, double sumy, double sumysq, double sse, boolean containsConstantIn, boolean copyData)
parametersIn
- a double array with the regression slope estimatesvarcov
- the variance covariance matrix, stored either in a square matrix
or as a compressedisSymmetricCompressed
- a flag which denotes that the variance covariance
matrix is in symmetric compressed formatnobsIn
- the number of observations of the regression estimationrankIn
- the number of independent variables in the regressionsumy
- the sum of the independent variablesumysq
- the sum of the squared independent variablesse
- sum of squared errorscontainsConstantIn
- true model has constant, false model does not have constantcopyData
- if true a deep copy of all input data is made, if false only references
are copied and the RegressionResults become mutablepublic double getParameterEstimate(int index)
Returns the parameter estimate for the regressor at the given index.
A redundant regressor will have its redundancy flag set, as well as a parameters estimated equal to
Double.NaN
index
- Index.OutOfRangeException
- if index
is not in the interval [0, number of parameters)
.public double[] getParameterEstimates()
Returns a copy of the regression parameters estimates.
The parameter estimates are returned in the natural order of the data.
A redundant regressor will have its redundancy flag set, as will a parameter estimate equal to Double.NaN
.
public double getStdErrorOfEstimate(int index)
index
- Index.OutOfRangeException
- if index
is not in the interval [0, number of parameters)
.public double[] getStdErrorOfEstimates()
Returns the standard error of the parameter estimates, usually denoted s(bi).
If there are problems with an ill conditioned design matrix then the regressor which is redundant will be
assigned Double.NaN
.
public double getCovarianceOfParameters(int i, int j)
Returns the covariance between regression parameters i and j.
If there are problems with an ill conditioned design matrix then the covariance which involves redundant columns
will be assigned Double.NaN
.
i
- i
th regression parameter.j
- j
th regression parameter.OutOfRangeException
- if i
or j
is not in the
interval [0, number of parameters)
.public int getNumberOfParameters()
Returns the number of parameters estimated in the model.
This is the maximum number of regressors, some techniques may drop redundant parameters
public long getN()
public double getTotalSumSquares()
Returns the sum of squared deviations of the y values about their mean.
This is defined as SSTO here.
If n < 2
, this returns Double.NaN
.
public double getRegressionSumSquares()
Returns the sum of squared deviations of the predicted y values about their mean (which equals the mean of y).
This is usually abbreviated SSR or SSM. It is defined as SSM here
Preconditions:
Double.NaN
is returned.public double getErrorSumSquares()
Returns the sum of squared errors (SSE) associated with the regression model.
The return value is constrained to be non-negative - i.e., if due to rounding errors the computational formula returns a negative result, 0 is returned.
Preconditions:
Double,NaN
is returned.public double getMeanSquareError()
Returns the sum of squared errors divided by the degrees of freedom, usually abbreviated MSE.
If there are fewer than numberOfParameters + 1 data pairs in the model, or if there is no
variation in x
, this returns Double.NaN
.
public double getRSquared()
Returns the coefficient of multiple determination, usually denoted r-square.
Preconditions:
Double,NaN
is returned.public double getAdjustedRSquared()
Returns the adjusted R-squared statistic, defined by the formula
R2adj = 1 - [SSR (n - 1)] / [SSTO (n - p)]where SSR is the sum of squared residuals}, SSTO is the total sum of squares}, n is the number of observations and p is the number of parameters estimated (including the intercept).
If the regression is estimated without an intercept term, what is returned is
1 - (1 - getRSquared()
) * (n / (n - p))
public boolean hasIntercept()
parameter estimates
.Copyright © 2019 CNES. All rights reserved.