G02CBF performs a simple linear regression with no constant, with dependent variable and independent variable .
G02CBF fits a straight line of the form
to the data points
such that
The routine calculates the regression coefficient,
, and the various other statistical quantities by minimizing
The input data consists of the
pairs of observations
on the independent variable
and the dependent variable
.
The quantities calculated are:
(a) |
Means:
|
(b) |
Standard deviations:
|
(c) |
Pearson product-moment correlation coefficient:
|
(d) |
The regression coefficient, :
|
(e) |
The sum of squares attributable to the regression, , the sum of squares of deviations about the regression, , and the total sum of squares, :
|
(f) |
The degrees of freedom attributable to the regression, , the degrees of freedom of deviations about the regression, , and the total degrees of freedom, :
|
(g) |
The mean square attributable to the regression, , and the mean square of deviations about the regression,
|
(h) |
The value for the analysis of variance:
|
(i) |
The standard error of the regression coefficient:
|
(j) |
The value for the regression coefficient:
|
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
If, in calculating
or
(see
Section 3), the numbers involved are such that the result would be outside the range of numbers which can be stored by the machine, then the answer is set to the largest quantity which can be stored as a real variable, by means of a call to
X02ALF.
Not applicable.
G02CBF uses a two-pass algorithm.
This example reads in eight observations on each of two variables, and then performs a simple linear regression with no constant with the first variable as the independent variable, and the second variable as the dependent variable. Finally the results are printed.