options double crt; name OLS 'NIST StRD Ordinary Least Squares benchmarks'; supres smpl nob coef; const it,0 nmodel,11; load; mform(nrow=nmodel,ncol=5) tab; ? Beta SE FStat R2 P/F ? Norris11 const nob,36; list xs c x; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; -0.262323073774029 0.232818234301152 1.00211681802045 0.429796848199937E-03 mmake val2 5436385.54079785 0.999993745883712; smpl 1,nob; read y x; .1 .2 338.8 337.4 118.1 118.2 888 884.6 9.2 10.1 228.1 226.5 668.5 666.3 998.5 996.3 449.1 448.6 778.9 777 559.2 558.2 .3 .4 .1 .6 778.1 775.5 668.8 666.9 339.3 338 448.9 447.5 10.8 11.6 557.7 556 228.3 228.1 998 995.8 888.8 887.6 119.6 120.2 .3 .3 .6 .3 557.6 556.8 339.3 339.1 888 887.2 998.5 999 778.9 779 10.2 11.1 117.6 118.3 228.9 229.2 668.4 669.1 449.2 448.9 .2 .5 cert y; ? Pontius const nob,40; list xs c x x2; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 0.673565789473684E-03 0.107938612033077E-03 0.732059160401003E-06 0.157817399981659E-09 -0.316081871345029E-14 0.486652849992036E-16 mmake val2 185330865.995752 0.999999900178537; smpl 1,nob; read y x; .11019 150000 .21956 300000 .32949 450000 .43899 600000 .54803 750000 .65694 900000 .76562 1050000 .87487 1200000 .98292 1350000 1.09146 1500000 1.20001 1650000 1.30822 1800000 1.41599 1950000 1.52399 2100000 1.63194 2250000 1.73947 2400000 1.84646 2550000 1.95392 2700000 2.06128 2850000 2.16844 3000000 .11052 150000 .22018 300000 .32939 450000 .43886 600000 .54798 750000 .65739 900000 .76596 1050000 .87474 1200000 .98300 1350000 1.09150 1500000 1.20004 1650000 1.30818 1800000 1.41613 1950000 1.52408 2100000 1.63159 2250000 1.73965 2400000 1.84696 2550000 1.95445 2700000 2.06177 2850000 2.16829 3000000 x2 = x**2; cert y; ? NoInt1 const nob,11; list xs x; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 2.07438016528926 0.165289256198347E-01 mmake val2 15750.2500000000 0.999365492298663; smpl 1,nob; read y x; 130 60 131 61 132 62 133 63 134 64 135 65 136 66 137 67 138 68 139 69 140 70 cert y; ? NoInt2 const nob,3; list xs x; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 0.727272727272727 0.420827318078432E-01 mmake val2 298.6666666666667 0.993348115299335; smpl 1,nob; read y x; 3 4 4 5 4 6 cert y; ? Filippelli const nob,82; list xs c x x2-x10; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; -1467.48961422980 298.084530995537 -2772.17959193342 559.779865474950 -2316.37108160893 466.477572127796 -1127.97394098372 227.204274477751 -354.478233703349 71.6478660875927 -75.1242017393757 15.2897178747400 -10.8753180355343 2.23691159816033 -1.06221498588947 0.221624321934227 -0.670191154593408E-01 0.142363763154724E-01 -0.246781078275479E-02 0.535617408889821E-03 -0.402962525080404E-04 0.896632837373868E-05 mmake val2 2162.43954511489 0.996727416185620; smpl 1,nob; read y x; .8116 -6.860120914 .9072 -4.324130045 .9052 -4.358625055 .9039 -4.358426747 .8053 -6.955852379 .8377 -6.661145254 .8667 -6.355462942 .8809 -6.118102026 .7975 -7.115148017 .8162 -6.815308569 .8515 -6.519993057 .8766 -6.204119983 .8885 -5.853871964 .8859 -6.109523091 .8959 -5.79832982 .8913 -5.482672118 .8959 -5.171791386 .8971 -4.851705903 .9021 -4.517126416 .909 -4.143573228 .9139 -3.709075441 .9199 -3.499489089 .8692 -6.300769497 .8872 -5.953504836 .89 -5.642065153 .891 -5.031376979 .8977 -4.680685696 .9035 -4.329846955 .9078 -3.928486195 .7675 -8.56735134 .7705 -8.363211311 .7713 -8.107682739 .7736 -7.823908741 .7775 -7.522878745 .7841 -7.218819279 .7971 -6.920818754 .8329 -6.628932138 .8641 -6.323946875 .8804 -5.991399828 .7668 -8.781464495 .7633 -8.663140179 .7678 -8.473531488 .7697 -8.247337057 .77 -7.971428747 .7749 -7.676129393 .7796 -7.352812702 .7897 -7.072065318 .8131 -6.774174009 .8498 -6.478861916 .8741 -6.159517513 .8061 -6.835647144 .846 -6.53165267 .8751 -6.224098421 .8856 -5.910094889 .8919 -5.598599459 .8934 -5.290645224 .894 -4.974284616 .8957 -4.64454848 .9047 -4.290560426 .9129 -3.885055584 .9209 -3.408378962 .9219 -3.13200249 .7739 -8.726767166 .7681 -8.66695597 .7665 -8.511026475 .7703 -8.165388579 .7702 -7.886056648 .7761 -7.588043762 .7809 -7.283412422 .7961 -6.995678626 .8253 -6.691862621 .8602 -6.392544977 .8809 -6.067374056 .8301 -6.684029655 .8664 -6.378719832 .8834 -6.065855188 .8898 -5.752272167 .8964 -5.132414673 .8963 -4.811352704 .9074 -4.098269308 .9119 -3.66174277 .9228 -3.2644011 tmp = x; dot 2-10; tmp = tmp*x; x. = tmp; enddot; cert y; ? Longley const nob,16; list xs c x1-x6; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; -3482258.63459582 890420.383607373 15.0618722713733 84.9149257747669 -0.358191792925910E-01 0.334910077722432E-01 -2.02022980381683 0.488399681651699 -1.03322686717359 0.214274163161675 -0.511041056535807E-01 0.226073200069370 1829.15146461355 455.478499142212 mmake val2 330.285339234588 0.995479004577296 ;smpl 1,nob; read y x1-x6; 60323 83.0 234289 2356 1590 107608 1947 61122 88.5 259426 2325 1456 108632 1948 60171 88.2 258054 3682 1616 109773 1949 61187 89.5 284599 3351 1650 110929 1950 63221 96.2 328975 2099 3099 112075 1951 63639 98.1 346999 1932 3594 113270 1952 64989 99.0 365385 1870 3547 115094 1953 63761 100.0 363112 3578 3350 116219 1954 66019 101.2 397469 2904 3048 117388 1955 67857 104.6 419180 2822 2857 118734 1956 68169 108.4 442769 2936 2798 120445 1957 66513 110.8 444546 4681 2637 121950 1958 68655 112.6 482704 3813 2552 123366 1959 69564 114.2 502601 3931 2514 125368 1960 69331 115.7 518173 4806 2572 127852 1961 70551 116.9 554894 4007 2827 130081 1962 cert y; ? Wampler1 const nob,21; list xs c x x2-x5; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 1 0 1 0 1 0 1 0 1 0 1 0 mmake val2 1e+37 1 ? F-stat is infinite ;smpl 1,nob; trend x 0; tmp = x; dot 2-5; tmp = tmp*x; x. = tmp; enddot; read y; 1 6 63 364 1365 3906 9331 19608 37449 66430 111111 177156 271453 402234 579195 813616 1118481 1508598 2000719 2613660 3368421 cert y; ? Wampler2 const nob,21; list xs c x x2-x5; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 1 0 .1 0 .01 0 .001 0 .0001 0 .00001 0 mmake val2 1e+37 1 ? F-stat is infinite ;smpl 1,nob; ? same xs as before read y; 1 1.11111 1.24992 1.42753 1.65984 1.96875 2.38336 2.94117 3.68928 4.68559 6 7.71561 9.92992 12.75603 16.32384 20.78125 26.29536 33.05367 41.26528 51.16209 63 cert y; ? Wampler3 const nob,21; list xs c x x2-x5; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 1 2152.32624678170 1 2363.55173469681 1 779.343524331583 1 101.475507550350 1 5.64566512170752 1 0.112324854679312 mmake val2 675524.458240122 0.999995559025820 ;smpl 1,nob; ? same xs as before read y; 760 -2042 2111 -1684 3888 1858 11379 17560 39287 64382 113159 175108 273291 400186 581243 811568 1121004 1506550 2002767 2611612 3369180 cert y; ? Wampler4 const nob,21; list xs c x x2-x5; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 1 215232.624678170 1 236355.173469681 1 77934.3524331583 1 10147.5507550350 1 564.566512170752 1 11.2324854679312 mmake val2 67.5524458240122 0.957478440825662 ;smpl 1,nob; ? same xs as before read y; 75901 -204794 204863 -204436 253665 -200894 214131 -185192 221249 -138370 315911 -27644 455253 197434 783995 608816 1370781 1303798 2205519 2408860 3444321 cert y; ? Wampler5 const nob,21; list xs c x x2-x5; length xs nx; read(nrow=nx,ncol=2,type=gen) vals; 1 21523262.4678170 1 23635517.3469681 1 7793435.24331583 1 1014755.07550350 1 56456.6512170752 1 1123.24854679312 mmake val2 6.7552445824012241E-03 0.224668921574940E-02 ;smpl 1,nob; ? same xs as before read y; 7590001 -20479994 20480063 -20479636 25231365 -20476094 20489331 -20460392 18417449 -20413570 20591111 -20302844 18651453 -20077766 21059195 -19666384 26348481 -18971402 22480719 -17866340 10958421 cert y; write(format="(/' OLS results'/ 9X,' ----Number of Digits-----'/ ' Model ',' Beta SE(B) FStat R**2 Pass=1/Fail=0')"); smpl 1,nmodel; unmake tab c1-c5; c5 = (c1 >= 7) & (c2 >= 7); ? Pass/Fail criteria mat npass = sum(c5); mmake tab cnames c1-c5; write(format="(1X,A8,4F7.1,F5.0)") tab; write(format="(' OLS summary: ',F3.0,'/11 passed.')") npass; ?====================================================== Proc Cert y; ? Procedure for running NIST StRD OLS benchmarks -- ? Record number of correct digits in table. ? Inputs: (mostly global variables) ? y = dependent variable ? xs = right hand side variables ? nx = number of RHS variables ? vals = nc x 4 matrix of starting and certified values ? nob = number of observations ? nyx = number of y, x series to read from nls.dat (can be zero) ? tab = table of output results ? it = pointer to row of tab (maintained here) ? by Clint Cummins 9/97 ? unmake matrix of certified values for Coefs and SEs into columns smpl 1,nx; unmake vals vcoef vse; mmake ccoef vcoef; mmake cse vse; unmake val2 cfstat cr2; smpl 1,nob; ? prepare for estimation set it = it+1; ? pointer to row of tables olsq(silent) y xs; ndigits @coef ccoef nd; set tab(it,1) = nd; ndigits @ses cse nd; set tab(it,2) = nd; set nd = 0; ? for cases with no intercept, where @FST is not stored ndigits @fst cfstat nd; set tab(it,3) = nd; ndigits @rsq cr2 nd; set tab(it,4) = nd; endproc; ?====================================================== Proc ndigits try true nd; ? Count the number of digits to which 2 numbers agree local dc; mat dc = abs[(try-true)/ (true + (true=0))]; ? denom is replaced by 1 if true=0 mat dc = (dc >= 1e-15)%dc + (dc < 1e-15)*1e-15; ? avoid log of zero mat nd = min( -log10(dc) ); endproc; ?====================================================== end; noprint; smpl 1,nmodel; read(format='(A8)') names; Norris11 Pontius NoInt1 NoInt2 Filippel Longley Wampler1 Wampler2 Wampler3 Wampler4 Wampler5 mmake cnames names;