# 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://www.nag.com/numeric/nl/nagdoc_28.7/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:

 result ¯x, the mean value of the independent variable, x; result ¯y, the mean value of the dependent variable, y; result sx the standard deviation of the independent variable, x; result sy the standard deviation of the dependent variable, y; result r, the Pearson product-moment correlation between the independent variable x and the dependent variable y; result b, the regression coefficient; result a, the regression constant; result se(b), the standard error of the regression coefficient; result se(a), the standard error of the regression constant; result t(b), the t value for the regression coefficient; result t(a), the t value for the regression constant; result SSR, the sum of squares attributable to the regression; result DFR, the degrees of freedom attributable to the regression; result MSR, the mean square attributable to the regression; result F, the F value for the analysis of variance; result SSD, the sum of squares of deviations about the regression; result DFD, the degrees of freedom of deviations about the regression result MSD, the mean square of deviations about the regression; result SST, the total sum of squares; result 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

linregs_const fits a straight line of the form

to 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:

1. Means:

2. Standard deviations:

3. Pearson product-moment correlation coefficient:

4. The regression coefficient, , and the regression constant, :

5. The sum of squares attributable to the regression, , the sum of squares of deviations about the regression, , and the total sum of squares, :

6. The degrees of freedom attributable to the regression, , the degrees of freedom of deviations about the regression, , and the total degrees of freedom, :

7. The mean square attributable to the regression, , and the mean square of deviations about the regression, :

8. The value for the analysis of variance:

9. The standard error of the regression coefficient, , and the standard error of the regression constant, :

10. 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