﻿QRRegressionCalculation Class

# QRRegressionCalculation Class

Class QRRegressionCalculation computes linear regression parameters by the method of least squares using a QR decomposition.
Inheritance Hierarchy
SystemObject
CenterSpace.NMath.CoreQRRegressionCalculation

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.4
Syntax
```[SerializableAttribute]
public class QRRegressionCalculation : IRegressionCalculation,
ICloneable```

The QRRegressionCalculation type exposes the following members.

Constructors
NameDescription
QRRegressionCalculation
Constrcts a QRRegressionCalculation instance with all sizes equal to zero.
QRRegressionCalculation(DoubleMatrix)
Constructs a QRRegressionCalculation instance from the given matrix.
QRRegressionCalculation(DoubleMatrix, Double)
Constructs a QRRegressionCalculation instance from the given matrix. The specified tolerance is used in computing the numerical rank of the matrix.
Top
Properties
NameDescription
Cols
Gets the number of columns in the matrix.
IsGood
Returns true if the QR decomposition may be used to solve least squares problems; otherwise false.
Rank
Gets the numerical rank of the matrix.
RankAvailable
Returns the rank if it was calculated as a byproduct of the parameter calculation.
Rows
Gets the number of rows in the matrix.
Tolerance
Gets and sets the tolerance used for computing the numerical rank of the regression matrix.
XTXInv
Gets the matrix formed by taking the inverse of the product of the transpose of the regression matrix with itself, if available.
XTXInvAvailable
Gets a boolean value indicating whether or not the matrix formed by taking the inverse of the product of the transpose of the regression matrix with itself is available.
Top
Methods
NameDescription
CalculateParameters(DoubleMatrix, DoubleVector)
Calculates the parameters for the regression using a QR decomposition of the regression matrix to solve the least squares problem.
CalculateParameters(DoubleMatrix, DoubleVector, Boolean)
Calculates the parameters for the regression using a QR decomposition of the regression matrix to solve the least squares problem.
Clone
Creates a deep copy of this regression calculator instance.
Factor(DoubleMatrix)
Factors a given matrix so that it may be used to solve least squares problems.
Factor(DoubleMatrix, Double)
Factors a given matrix so that it may be used to solve least squares problems. The specified tolerance is used in computing the numerical rank of the matrix.
Factor(DoubleMatrix, Double, Boolean)
Factors a given matrix so that it may be used to solve least squares problems. The specified tolerance is used in computing the numerical rank of the matrix.
ResidualNormSqr
Computes the 2-norm squared of the residual vector.
ResidualVector
Computes and returns the residual vector.
Solve
Computes the solution to the least squares problem Ax = b.
Top
Remarks
Class QRRegressionCalculation finds the minimal norm solution to the overdetermined linear system:
`Ax = b`
That is, this class finds the vector x that minimizes the 2-norm of the residual vector Ax - b. Prerequisites on the matrix A are that it has more rows than columns, and is of full rank.