Polynomial Curve Fitting
Vector 3:4, page 117
The text of this article is not yet online. No complete scan of this issue has been found. The only copy found, on vector.org.uk, is damaged: its page images are lost, but the text machine-read from them survives, shown below (help find a scan).
Unedited OCR text, machine-read from a scan now lost: it contains errors, and its APL is wrong. Shown for searching.
VECTOR Vol.3 No.4
Polynomial Curve Fitting
by Douglas
[refer to Dick Bowman’s and the Editor’s comments (VECTOR Vol.3, No.1, pp 99-100) on the different responses of different APL systems to a dyadic use of domino for polynomial curve fitting.
Dick’s remark, that it is i n t e r e s t i n g when the same code applied to the same data gives different results, is certainly valid. But without downplaying the importance of having good algorithmic and numerical procedures (“the code”), [ should like to emphasize the other aspect, the data, of what is a perpetual problem. The p e r p e t u a l problem” is to devise methods sufficiently robust for appropriate aralysis of any data; it is perpetual because whatever method may be devised it is always possible to invent data for which the method will misbehave.
What is often sought is a“. . . fitted curve . to look nice and smooth . . .” So let’s graph Dick’s data (see Figure 1). The curious behaviour at odd and even y e a r s is obvious, and no meaningful smooth curve seems plausible in particular, a cubic cannot possibly reproduce the marked oscillation of the Y-values at the later y e a r s X. To obviate readily removable DOMAIN or LIMIT ERROR difficulties, which may arise simply because large numbers like 1995 are raised to high powers in the calculations, subtract 1984 from X. This gives numerically reliable regression coefficients and a smooth fitted curve (see Figure 2) which is basically nonsense when thought of as representing the data. (APL*PLUS PC is capable of giving an equivalent to this result without having to subtract the 1984.) A more detailed analysis shows that of the four regression coefficients, only the first, associated with the constant term, is l a r g e (compared with its standard error) and likely to be meaningful, and that the mean square about the fitted cubic really isn’t much less than that about a constant fitted value.
The numerical results are as follows, with the data first: X:
1234567 8 91011 36 39 39 43 38 43 35 42 +B+YRA+Xe.*#0 1 returns the regression coefficients
34.212 2.040 -0.225 0.00777
for which the standard errors are:
5.1 3.5 0.67 0.037;
fitted values are calculated from a+.x3 Inspecting the data, the graph suggests that two distinct quadratics would represent them well at the years recorded: one quadratic for the odd, and another for the even, years. This fitting can be achieved by replacing the matrix A by the matrix C; both are shown below.
M17
VECTOR Vol.3 No.4
A c
oto. 1 1 1 0 0 1 2 4 8 1 0 0 2 4 1 39 2 1 3 9 0 0 1 4 16 64 1 0 0 4 16