Routine RLINE fits a line to a set of (x, y) data points using the method of least squares. Draper and Smith (1981, pages 1− 69) discuss the method. The fitted model is
where (stored in B0) is the estimated intercept and (stored in B1) is the estimated slope. In addition to the fit, RLINE produces some summary statistics, including the means, sample variances, correlation, and the error (residual) sum of squares. The estimated standard errors of are computed under the simple linear regression model. The errors in the model are assumed to be uncorrelated and with constant variance.
If the x values are all equal, the model is degenerate. In this case, RLINE sets to zero and to the mean of the y values.
Comments
Informational error
Type
Code
Description
4
1
Each (x, y) point contains NaN (not a number). There are no valid data.
Example
This example fits a line to a set of data discussed by Draper and Smith (1981, Table 1.1, pages 9-33). The response y is the amount of steam used per month (in pounds), and the independent variable x is the average atmospheric temperature (in degrees Fahrenheit).
USE RLINE_INT
USE UMACH_INT
USE WRRRL_INT
IMPLICIT NONE
INTEGER NOBS
PARAMETER (NOBS=25)
!
INTEGER NOUT
REAL B0, B1, STAT(12), XDATA(NOBS), YDATA(NOBS)
CHARACTER CLABEL(13)*15, RLABEL(1)*4
!
DATA XDATA/35.3, 29.7, 30.8, 58.8, 61.4, 71.3, 74.4, 76.7, 70.7,&