Correction: My computation of PRESS was wrong, and Mr. Antonio Trujillo-Ortiz was absolutely correct in the calculation of PRESS from his code. The problem was that I forgot to place a minus in front of one of the numbers, so I got a slightly different answer. Independently with different code, I got the same answer as Antonio Trujillo-Ortiz, which was 22225.0575. I apologize for the mistake.
The correct answer is 22225.0, which is correctly stated in the comment section of this code. However, the code does not compute this. Revision needed to compute PRESS value.
This code does not give the correct answer to the problem stated in Response Surface Methodology by Montgomery & Myers, page 48, which is 22,225. This code gives 21265.2514 by the two different methods in the code. It needs revision. See output below (some variables were printed):
Calculation of PRESS
n = 14
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
r = 13, c = 3
PRESS = 21265.2514
hii = 0.358818
hii = 0.379259
hii = 0.323410
hii = 0.294624
hii = 0.094723
hii = 0.137715
hii = 0.142682
hii = 0.242150
hii = 0.236885
hii = 0.202703
hii = 0.209627
hii = 0.073729
hii = 0.225672
hii = 0.078004
2nd PRESS = 21265.2514
>>