naginterfaces.library.correg.linregm_coeffs_noconst¶
- naginterfaces.library.correg.linregm_coeffs_noconst(n, sspz, rz)[source]¶
linregm_coeffs_noconst
performs a multiple linear regression with no constant on a set of variables whose sums of squares and cross-products about zero and correlation-like coefficients are given.For full information please refer to the NAG Library document for g02ch
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g02/g02chf.html
- Parameters
- nint
, the number of cases used in calculating the sums of squares and cross-products and correlation-like coefficients.
- sspzfloat, array-like, shape
must be set to , the sum of cross-products about zero for the th and th variables, for , for ; terms involving the dependent variable appear in row and column .
- rzfloat, array-like, shape
must be set to , the correlation-like coefficient for the th and th variables, for , for ; coefficients involving the dependent variable appear in row and column .
- Returns
- resultfloat, ndarray, shape
The following information:
, the sum of squares attributable to the regression;
, the degrees of freedom attributable to the regression;
, the mean square attributable to the regression;
, the value for the analysis of variance;
, the sum of squares of deviations about the regression;
, the degrees of freedom of deviations about the regression;
, the mean square of deviations about the regression;
, the total sum of squares;
, the total degrees of freedom;
, the standard error estimate;
, the coefficient of multiple correlation;
, the coefficient of multiple determination;
, the coefficient of multiple determination corrected for the degrees of freedom.
- coeffloat, ndarray, shape
For , the following information:
, the regression coefficient for the th variable.
, the standard error of the regression coefficient for the th variable.
, the value of the regression coefficient for the th variable.
- rznvfloat, ndarray, shape
The inverse of the matrix of correlation-like coefficients for the independent variables; that is, the inverse of the matrix consisting of the first rows and columns of .
- czfloat, ndarray, shape
The modified inverse matrix, , where
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
The partition of which requires inversion is not positive definite.
- (errno )
The refinement following the actual inversion has failed.
- Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
linregm_coeffs_noconst
fits a curve of the formto the data points
such that
The function calculates the regression coefficients, , (and various other statistical quantities) by minimizing
The actual data values are not provided as input to the function. Instead, input to the function consists of:
The number of cases, , on which the regression is based.
The total number of variables, dependent and independent, in the regression, .
The number of independent variables in the regression, .
The matrix of sums of squares and cross-products about zero of all the variables in the regression; the terms involving the dependent variable, , appear in the th row and column.
The matrix of correlation-like coefficients for all the variables in the regression; the correlations involving the dependent variable, , appear in the th row and column.
The quantities calculated are:
The inverse of the partition of the matrix of correlation-like coefficients, , involving only the independent variables. The inverse is obtained using an accurate method which assumes that this sub-matrix is positive definite (see Further Comments).
The modified matrix, , where
where is the th element of the inverse matrix of as described in (a) above. Each element of is thus the corresponding element of the matrix of correlation-like coefficients multiplied by the corresponding element of the inverse of this matrix, divided by the corresponding element of the matrix of sums of squares and cross-products about zero.
The regression coefficients:
where is the sum of cross-products about zero for the independent variable and the dependent variable .
The sum of squares attributable to the regression, , the sum of squares of deviations about the regression, , and the total sum of squares, :
, the sum of squares about zero for the dependent variable, ;
.
The degrees of freedom attributable to the regression, , the degrees of freedom of deviations about the regression, , and the total degrees of freedom, :
The mean square attributable to the regression, , and the mean square of deviations about the regression, :
The value for the analysis of variance:
The standard error estimate:
The coefficient of multiple correlation, , the coefficient of multiple determination, , and the coefficient of multiple determination corrected for the degrees of freedom, :
The standard error of the regression coefficients:
The values for the regression coefficients:
- References
Draper, N R and Smith, H, 1985, Applied Regression Analysis, (2nd Edition), Wiley