|Re: HP28S: Computing summary statistics?|
Message #2 Posted by James M. Prange on 27 Mar 2003, 1:25 a.m.,
in response to message #1 by Gary E. RAFE, Ph.D.
All of this assumes that you're using the calculator's statistics matrix
Try the Owner's Manual, Chapter 28 "Programming Examples", "Summary
Statistics" pages 262-269. The programs listed there should get you the
sum of squares and sum of products values.
For the sum of a column, just use the TOT command to get a vector
containing the sum of each column, and the GET command to extract the
value for whichever column you're interested in. It should be rather
trivial to write a program that uses SumPAR (where Sum represents upper
case Greek sigma) to determine which column is x and which one y.
Also see "Median of Statistics Data" pages 270-275.
Check out anything in the Owner's Manual or Reference Manual that has
anything to do with either statistics or arrays.
Of course, using summary statistics methods, there's a greater
likelihood that information will be lost due to rounding off, especially
in the sum of squares and sum of products. Back in the days when we did
this on paper or with calculators that used summary statistics methods,
we used what we referred to as "encoded data". Instead of using the
actual data, we used the difference from some set value (typically, but
not always, the most significant digits that were the same for all of
the data), multiplied by whatever power of 10 gave us whole numbers to
For example, if the input data were 12.3453, 12.3404, and 12.3429, then
the algorithm for obtaining the encoded value could be to subtract 12.34
and then multiply that result by 10000, giving us 53, 4, and 29 to work
with. After computing our statistical results, we would decode them
back; in the above example, we might find the mean of the encoded data
to be (approximately) 29 which we divided by 10000 and then added to
12.34 to obtain the result of 12.3429.
Even for calculators that keep all of the data in a matrix, I often find
it easier to enter the data in "encoded" form (it's easy enough to do
the encoding in my head), and then multiply a column by a power of 10
and add a constant to the column. This saves a lot of repetitive