# naginterfaces.library.correg.linregs_​const_​miss¶

naginterfaces.library.correg.linregs_const_miss(x, y, xmiss, ymiss)[source]

linregs_const_miss performs a simple linear regression with dependent variable and independent variable , omitting cases involving missing values.

For full information please refer to the NAG Library document for g02cc

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/g02/g02ccf.html

Parameters
xfloat, array-like, shape

must contain , for .

yfloat, array-like, shape

must contain , for .

xmissfloat

The value which is to be taken as the missing value for the variable . See Accuracy.

ymissfloat

The value which is to be taken as the missing value for the variable . See Accuracy.

Returns
resultfloat, ndarray, shape

The following information:

 result[0] ¯x, the mean value of the independent variable, x; result[1] ¯y, the mean value of the dependent variable, y; result[2] sx, the standard deviation of the independent variable, x; result[3] sy, the standard deviation of the dependent variable, y; result[4] r, the Pearson product-moment correlation between the independent variable x and the dependent variable y result[5] b, the regression coefficient; result[6] a, the regression constant; result[7] se(b), the standard error of the regression coefficient; result[8] se(a), the standard error of the regression constant; result[9] t(b), the t value for the regression coefficient; result[10] t(a), the t value for the regression constant; result[11] SSR, the sum of squares attributable to the regression; result[12] DFR, the degrees of freedom attributable to the regression; result[13] MSR, the mean square attributable to the regression; result[14] F, the F value for the analysis of variance; result[15] SSD, the sum of squares of deviations about the regression; result[16] DFD, the degrees of freedom of deviations about the regression; result[17] MSD, the mean square of deviations about the regression; result[18] SST, the total sum of squares; result[19] DFT, the total degrees of freedom; result[20] nc, the number of observations used in the calculations.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

After observations with missing values were omitted, two or fewer cases remained.

(errno )

After observations with missing values were omitted, all remaining values of at least one of and were identical.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

linregs_const_miss fits a straight line of the form

to those of the data points

that do not include missing values, such that

for those , which do not include missing values.

The function eliminates all pairs of observations which contain a missing value for either or , and then calculates the regression coefficient, , the regression constant, , and various other statistical quantities, by minimizing the sum of the over those cases remaining in the calculations.

The input data consists of the pairs of observations on the independent variable and the dependent variable .

In addition two values, and , are given which are considered to represent missing observations for and respectively. (See Accuracy).

Let if the th observation of either or is missing, i.e., if and/or ; and otherwise, for .

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

11. The number of observations used in the calculations:

References

Draper, N R and Smith, H, 1985, Applied Regression Analysis, (2nd Edition), Wiley