naginterfaces.library.correg.linregs_noconst_miss¶
- naginterfaces.library.correg.linregs_noconst_miss(x, y, xmiss, ymiss)[source]¶
linregs_noconst_miss
performs a simple linear regression with no constant, with dependent variable and independent variable , omitting cases involving missing values.For full information please refer to the NAG Library document for g02cd
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02cdf.html
- Parameters
- 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 value ;
, the standard error of the regression coefficient;
the value ;
, the value for the regression coefficient;
the value ;
, 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 number of observations used in the calculations.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
After observations with missing values were omitted, fewer than two 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_noconst_miss
fits a straight line of the formto those of the data points
that do not include missing values, such that
for those , for 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, , 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:
Means:
Standard deviations:
Pearson product-moment correlation coefficient:
The regression coefficient, :
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:
The value for the regression coefficient:
The number of observations used in the calculations:
- References
Draper, N R and Smith, H, 1985, Applied Regression Analysis, (2nd Edition), Wiley