Palgrave Handbook of Econometrics: Applied Econometrics

(Grace) #1

1298 Testing Econometric Software


Table 28.3 Dataset NASTY.DAT

LABEL$ X ZERO MISS BIG LITTLE HUGE TINY ROUND

ONE 1 0. 99999991 0.99999991 1.0E12 1.0E-12 0.5
TWO 2 0. 99999992 0.99999992 2.0E12 2.0E-12 1.5
THREE 3 0. 99999993 0.99999993 3.0E12 3.0E-12 2.5
FOUR 4 0. 99999994 0.99999994 4.0E12 4.0E-12 3.5
FIVE 5 0. 99999995 0.99999995 5.0E12 5.0E-12 4.5
SIX 6 0. 99999996 0.99999996 6.0E12 6.0E-12 5.5
SEVEN 7 0. 99999997 0.99999997 7.0E12 7.0E-12 6.5
EIGHT 8 0. 99999998 0.99999998 8.0E12 8.0E-12 7.5
NINE 9 0. 99999999 0.99999999 9.0E12 9.0E-12 8.5

in question employed the “calculator formula”:


s^2 =

∑n
i= 1 x

2
i−(

∑n
i= 1 xi)

(^2) /n
n− 1


. (28.1)


This formula makes one pass through the data and squares the observations.


Consider squaring the first two observations on the variable BIG: 99999991^2 =


9999998200000081 and 99999992^2 =9999998400000064. Now subtract the for-
mer from the latter: 9999998400000064− 9999998200000081 =199999983. On
a typical desktop econometric package, executing the command 99999992^2 −
999999912 produces 199999984. The squaring of these large numbers has just
barely used up the computer’s finite precision. To see this, simply drop the lead-
ing nines and perform the following subtraction on your desktop computer:
8400000064 − 8200000081 =199999983, which does not exhaust a desktop com-
puter’s precision. Think of what would happen if nine-digit numbers were used
instead of eight-digit numbers! Using the calculator formula to compute the sam-
ple variance of the variable BIG yields 2.424 instead of the correct 2.738. This is an
example of what was described in the first section as an algorithm simply not being
up to the task. The calculator formula contrasts sharply with the usual formula:


σˆ^2 =

∑n
i= 1 (xi−x ̄)

2
n− 1

, (28.2)

which squares much smaller numbers, and so it is more difficult for this formula
to exhaust the computer’s finite precision.
The calculator formula, often presented in textbooks in the pre-computer era,
was designed for use on toy problems found in textbooks, not for real-life problems.
This fact was known in the statistical computing literature at least as far back as
Ling (1974), and in one of the two classic texts on statistical computing that every
competent statistical programmer would have read, i.e., Thisted (1988) (the other
classic text is Kennedy and Gentle, 1980). Nonetheless, the calculator formula
appeared in many statistical and econometric software packages. What this tells us
is that the people who designed these programs were not versed in the basics of

Free download pdf