NMath User's Guide

TOC | Previous | Next | Index

42.2 Regression Results (.NET, C#, CSharp, VB, Visual Basic, F#)

Class LinearRegression provides the following properties for accessing the regression results:

IsGood gets a boolean value indicating whether or not the model parameters were successfully computed.

ParameterCalculationErrorMessage gets any error message produced by the regression calculation object.

Parameters gets the vector of computed model parameters.

ParameterEstimates gets an array of LinearRegressionParameter objects suitable for performing hypothesis testing on individual parameters (see Section 42.5).

Residuals gets the vector of residuals. This is the difference between the vector of observed values and the values predicted by the model.

Variance gets an estimate of the variance. This is the residual sum of squares divided by the degrees of freedom for the model. The degrees of freedom for the model is equal to the difference between the number of observations and the number of parameters.

CovarianceMatrix gets the covariance matrix (sometimes called the dispersion matrix or variance-covariance matrix).

GetStandardizedResiduals() gets the standardized residuals (also known as the internally studentized residuals). The residuals are renormalized to have unit variance using an overall measure of error variance.

GetStudentizedResiduals() gets the (externally) studentized residuals, which renormalizes the residuals to have unit variance using a leave-one-out measure of error variance—that is, a vector of estimates of the residual variance obtained when the i-th case is dropped from the regression.

For more information about a linear regression fit, you can perform hypothesis tests on individual parameters (Section 42.5) or the overall model (Section 42.6).

You can also modify the model and recalculate the parameters, as described in Section 42.4.

Variance Inflation Factor

The variance inflation factor (VIF) quantifies the severity of multicollinearity in a least squares regression analysis—that is, how much the variance of a coefficient is increased because of collinearity. Class LinearRegression provides methods VarianceInflationFactor() and VarianceInflationFactors() for this purpose. For instance:

Code Example – C# linear regression

DoubleVector vif = lr.VarianceInflationFactors();

Code Example – VB linear regression

Dim VIF As DoubleVector = LR.VarianceInflationFactors()