Click or drag to resize

LinearRegression Class

Class LinearRegression computes a multiple linear regression from an input matrix of independent variable values and vector of dependent variable values.
Inheritance Hierarchy

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.3
Syntax
[SerializableAttribute]
public class LinearRegression : RegressionBase, 
	ICloneable

The LinearRegression type exposes the following members.

Constructors
  NameDescription
Public methodLinearRegression
Default constructor. Constructs a LinearRegression instance with all sizes equal to zero.
Public methodLinearRegression(DataFrame, IDFColumn)
Constructs a LinearRegression instance with the specifed regresssion data and observation column. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DataFrame, Int32)
Constructs a LinearRegression instance with the specifed regresssion data and an index to the observation column. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DoubleMatrix, DoubleVector)
Constructs a LinearRegression instance with the specifed regresssion matrix and observation vector. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DataFrame, IDFColumn, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion data and observation column. Model parameter values are computed using the specified regression calculator.
Public methodLinearRegression(DataFrame, IDFColumn, Boolean)
Constructs a LinearRegression instance with the specifed regresssion data and observation column, optionally adding an intercept parameter. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DataFrame, Int32, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion data and an index to the observation column. Model parameter values are computed using the specified regression calculator.
Public methodLinearRegression(DataFrame, Int32, Boolean)
Constructs a LinearRegression instance with the specifed regresssion data and an index to the observation column, optionally adding an intercept parameter. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DoubleMatrix, DoubleVector, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion matrix and observation vector. Model parameter values are computed using the specified regression calculator.
Public methodLinearRegression(DoubleMatrix, DoubleVector, Boolean)
Constructs a LinearRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. By default, the model parameter values are computed using a QR factorization.
Public methodLinearRegression(DataFrame, IDFColumn, Boolean, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion data and observation column, optionally adding an intercept parameter. The model parameter values are computed using the specified regression calculator.
Public methodLinearRegression(DataFrame, Int32, Boolean, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion data and an index to the observation column, optionally adding an intercept parameter. The model parameter values are computed using the specified regression calculator.
Public methodLinearRegression(DoubleMatrix, DoubleVector, Boolean, IRegressionCalculation)
Constructs a LinearRegression instance with the specifed regresssion matrix and observation vector, optionally adding an intercept parameter. The model parameter values are computed using the specified regression calculator.
Top
Properties
  NameDescription
Public propertyCheckData
Gets and sets a boolean indicating whether or not to check input data for non-numeric values. If input data is large checking all values for NaN's and infinities can be a performance consideration.
Public propertyColumnResizeIncrement
Gets and sets the amount by which the regression matrix is resized if columns are added.
(Inherited from RegressionBase.)
Public propertyCovarianceMatrix
Gets the covariance matrix.
Public propertyHasInterceptParameter
Returns true if the model has an intercept parameter; otherwise, false.
(Inherited from RegressionBase.)
Public propertyIntercept
Gets the intercept.
(Inherited from RegressionBase.)
Public propertyIsGood
Returns true if the model parameters were successfuly computed; otherwise, false.
(Inherited from RegressionBase.)
Public propertyNumberOfObservations
Gets the number of observations.
(Inherited from RegressionBase.)
Public propertyNumberOfParameters
Gets the number of parameters in the model.
(Inherited from RegressionBase.)
Public propertyNumberOfPredictors
Gets the number of predictors.
(Inherited from RegressionBase.)
Public propertyObservations
Gets the vector of observations.
(Inherited from RegressionBase.)
Public propertyParameterCalculationErrorMessage
Gets the error message associated with a failed parameter calculation.
(Inherited from RegressionBase.)
Public propertyParameterEstimates
Gets an array of parameter objects which may be used to perform hypothesis tests on individual parameters in the model.
Public propertyParameters
Gets the computed model parameters.
(Inherited from RegressionBase.)
Public propertyPredictorMatrix
Gets the predictor matrix.
(Inherited from RegressionBase.)
Public propertyRegressionCalculator
Gets and sets the regression calculation object used for computing the model parameters.
Public propertyRegressionMatrix
Gets the regression matrix.
(Inherited from RegressionBase.)
Public propertyResiduals
Get the vector of residuals.
Public propertyRowResizeIncrement
Gets and sets the amount by which the regression matrix is resized if rows are added.
(Inherited from RegressionBase.)
Public propertyVariance
Gets an estimate of the variance.
Top
Methods
  NameDescription
Public methodAddInterceptParameter
Adds an intercept parameter to the model and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodAddObservation
Adds the given observation to the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodAddObservations
Adds the given observations to the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodAddPredictor
Adds a predictor to the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodAddPredictors
Adds predictors to the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodClone
Creates a deep copy of this LinearRegression.
Public methodGetStandardizedResiduals
Returns the standardized residuals (also known as the internally studentized residuals).
Public methodGetStudentizedResiduals
Returns the (externally) studentized residuals.
Public methodPredictedObservation
Returns the value of the dependent variable predicted by the model for the given set of predictor values.
Public methodPredictedObservations
Returns the values of the dependent variable predicted by the model for the given sets of predictor values.
Public methodPredictionInterval
Returns a confidence interval for the value of the dependent variable predicted by the model for the given set of predictor values.
Public methodRecalculateParameters
Recalculates the model parameters.
(Overrides RegressionBaseRecalculateParameters.)
Public methodRemoveInterceptParameter
Removes the intercept parameter from the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodRemoveObservation
Removes the row at the indicated index from the predictor matrix and the corresponding element from the observation vector, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodRemoveObservations
Removes the specified rows from the predictor matrix, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodRemovePredictor
Removes the specified predictor from the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodCode exampleRemovePredictors
Removes the specified predictors from the model, and recalculates the model parameters.
(Inherited from RegressionBase.)
Public methodSetRegressionData(DataFrame, IDFColumn, Boolean)
Sets the regression matrix, observation vector, and intercept option to the specified values, and recalculates the model parameters.
Public methodSetRegressionData(DoubleMatrix, DoubleVector, Boolean)
Sets the regression matrix, observation vector, and intercept option to the specified values, and recalculates the model parameters.
Public methodVarianceInflationFactor
An index which measures how much the variance of a coefficient (square of the standard deviation) is increased because of collinearity.
Public methodVarianceInflationFactors
An index which measures how much the variance of a coefficient (square of the standard deviation) is increased because of collinearity.
Top
Fields
  NameDescription
Protected fieldcolResizeIncrement_
Number of columns to add when adding variables (if needed).
(Inherited from RegressionBase.)
Public fieldStatic memberDEFAULT_REGRESSION_CALCULATION
Default regression calculation is QRRegressionCalculation.
Protected fielderrorMessage_
Explains errors, if any.
(Inherited from RegressionBase.)
Protected fieldhasIntercept_
Does the model have an intercept parameter?
(Inherited from RegressionBase.)
Protected fieldisGood_
Is the regression good?
(Inherited from RegressionBase.)
Protected fieldobservationData_
Full set of observations.
(Inherited from RegressionBase.)
Protected fieldobservations_
Subvector of the observation data used in the current regression model. observations_ = observationData_[regMatRowSlice_].
(Inherited from RegressionBase.)
Protected fieldparameters_
Model paramters.
(Inherited from RegressionBase.)
Protected fieldregMatColSlice_
regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase.)
Protected fieldregMatRowSlice_
regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase.)
Protected fieldregressionData_
The full set of regression data.
(Inherited from RegressionBase.)
Protected fieldregressionMatrix_
A submatrix of the regression used in this regression model. regressionMatrx_ = regressionData_[regMatRowSlice_, regMatColSlice_]
(Inherited from RegressionBase.)
Protected fieldrowResizeIncrement_
Number of rows to add when adding observations (if needed).
(Inherited from RegressionBase.)
Top
See Also