g02caf fits a straight line of the form
to the data points
such that
The routine 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:
-
(a)Means:
-
(b)Standard deviations:
-
(c)Pearson product-moment correlation coefficient:
-
(d)The regression coefficient, , and the regression constant,
:
-
(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, , and the standard error of the regression constant, :
-
(j)The value for the regression coefficient, , and the value for the regression constant, :
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.
Background information to multithreading can be found in the
Multithreading documentation.
The routine uses a two-pass algorithm.
This example reads in eight observations on each of two variables, and then performs a simple linear regression with the first variable as the independent variable, and the second variable as the dependent variable. Finally the results are printed.