options double nwidth=20 signif=8 crt; ? double is used to store ? data in double precision (series BIG and LITTLE have 8 significant ? digits; single precision can only represent 6-7 digits). ? Also, the polynomial terms X8 and X9 have a large number of ? significant digits (X9 has 9 significant digits). ? Nwidth and Signif are used to print more than the usual digits name nasty "Wilkinson's Statistics Quiz, Sections II-IV"; load; ?*** II *** title 'round - II.A'; write(format='(F3.0)') round; ? rounds to even numbers on Sun, rounds up ? on PC and VAX title 'round - II.A.2'; set y1 = int(2.6*7 - 0.2); set y1t=18; set y2 = 2-int(exp(log(sqrt(2)*sqrt(2)))); set y2t=0; set y3 = int(3-exp(log(sqrt(2)*sqrt(2)))); set y3t=1; ? yields 0 on Sun print y1-y3; print y1t-y3t; ? II.B graph huge tiny; ? the axis labels for HUGE are ******** (i.e. off scale) graph big little; graph x zero; list all x zero miss big little huge tiny round; ? II.C msd x zero big little huge tiny round; ? drop out MISS by hand; otherwise ? the default will drop all observations. ? This crashes (overflow) on the VAX, when trying to compute ? the Kurtosis of HUGE, although this was not requested for II.C ?msd(byvar) all; ? Alternative - override the default to compute stats ? on each variable separately. ? II.D corr x zero big little huge tiny round; ? same comments as above ? Note: computes Corr(ZERO,*) = 0, rather than missing. ? (perhaps this should be fixed...) ?corr(pairwise) all; ? Alternative ? II.E -- tabulate X against X with weight BIG, and HUGE against TINY ? (no crosstab feature in TSP) olsq big c x; ? II.F ?*** III *** ? III.A test = 1*(miss=3) + 2*(miss .ne. 3); ? this is the standard way of ? doing such recoding in TSP. TEST is always missing print test; ? (which Wilkinson and Sawitzki note is consistent) ? III.B select miss(miss); miss = miss + 1; print miss; ? III.C -- tabulate MISS against ZERO ? (no crosstab feature in TSP) ?*** IV *** dot(value=i) 2-9; x. = x**i; enddot; olsq x c x2-x9; ? IV.A Results agree with Sawitzki, but he doesn't ? state how he computed them. They differ from SYSTAT. olsq x c x; ? IV.B olsq x c big little; ? IV.C olsq zero c x; ? IV.D ? Check number of significant digits in X9 (this is why the default ? single precision data storage does not yield quite the same results ? as IV.A on double precision data). options nodouble; x9s = x9; res9 = x9 - x9s; msd(terse) x9 x9s res9; ? X9 has 9 significant digits end; noprint; smpl 1,9; ? note: MISS and ROUND are reserved function names in TSP, ? so they result in warning messages here. read x zero miss big little huge tiny round; 1 0 . 99999991 0.99999991 1.0E12 1.0E-12 0.5 2 0 . 99999992 0.99999992 2.0E12 2.0E-12 1.5 3 0 . 99999993 0.99999993 3.0E12 3.0E-12 2.5 4 0 . 99999994 0.99999994 4.0E12 4.0E-12 3.5 5 0 . 99999995 0.99999995 5.0E12 5.0E-12 4.5 6 0 . 99999996 0.99999996 6.0E12 6.0E-12 5.5 7 0 . 99999997 0.99999997 7.0E12 7.0E-12 6.5 8 0 . 99999998 0.99999998 8.0E12 8.0E-12 7.5 9 0 . 99999999 0.99999999 9.0E12 9.0E-12 8.5 ;