The constructor

The constructor method for the SimpleLinearRegression class accepts an X and a Y vector with the same number of values in each vector. You can also set a confidence interval for your predicted Y values (default is a 95 percent confidence interval).

The constructor method begins by verifying that the data is in a
form suitable for processing. Once the input vectors have passed the
"equal size" and "size greater than 1" tests, the heart of the
algorithm is executed.

Performing this task involves computing intermediate and summary
values for the statistical procedure through a series of getter
methods. The return value from each method call is assigned to an
instance variable for the class. Storing calculational results in this
way ensures that the intermediate and summary values can be used by the
calling routine in chained calculations. The results can also be
displayed by calling the output methods for the class, as is described
in Listing 2.

The method names and their sequence were derived by a combination of
backward chaining and consulting an undergraduate statistics textbook
that provided step-by-step instructions for computing intermediate
values. The names of the intermediate values that I needed to compute
were prefixed with "get" to derive the method name.