naginterfaces.library.correg.linregs_const¶
- naginterfaces.library.correg.linregs_const(x, y)[source]¶
linregs_const
performs a simple linear regression with dependent variable and independent variable .For full information please refer to the NAG Library document for g02ca
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g02/g02caf.html
- Parameters
- xfloat, array-like, shape
must contain , for .
- yfloat, array-like, shape
must contain , for .
- Returns
- resultfloat, ndarray, shape
The following information:
, the mean value of the independent variable, ;
, the mean value of the dependent variable, ;
the standard deviation of the independent variable, ;
the standard deviation of the dependent variable, ;
, the Pearson product-moment correlation between the independent variable and the dependent variable ;
, the regression coefficient;
, the regression constant;
, the standard error of the regression coefficient;
, the standard error of the regression constant;
, the value for the regression coefficient;
, the value for the regression constant;
, 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;
DFT, the total degrees of freedom.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, all values of at least one of and are identical.
- Notes
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
linregs_const
fits a straight line of the formto the data points
such that
The function calculates the regression coefficient, , the regression constant, (and various other statistical quantities) by minimizing
The input data consist of the pairs of observations
on the independent variable and the dependent variable .
The quantities calculated are:
Means:
Standard deviations:
Pearson product-moment correlation coefficient:
The regression coefficient, , and the regression constant, :
The sum of squares attributable to the regression, , the sum of squares of deviations about the regression, , and the total sum of squares, :
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 of the regression coefficient, , and the standard error of the regression constant, :
The value for the regression coefficient, , and the value for the regression constant, :
- References
Draper, N R and Smith, H, 1985, Applied Regression Analysis, (2nd Edition), Wiley