Distribution Test Data, and log relative error functionpackage:accuracyR Documentation

_B_e_n_c_h_m_a_r_k _d_a_t_a _t_o _t_e_s_t _t_h_e _a_c_c_u_r_a_c_y _o_f _s_t_a_t_i_s_t_i_c_a_l _d_i_s_t_r_i_b_u_t_i_o_n _f_u_n_c_t_i_o_n_s, _f_u_n_c_t_i_o_n _t_o _c_o_m_p_u_t_e _l_o_g _r_e_l_a_t_i_v_e _e_r_r_o_r

_D_e_s_c_r_i_p_t_i_o_n:

     This is benchmark data, used to test the accuracy of statistical
     distribution functions. Also included is a function for computing
     log-relative error, a measure of accuracy.

_U_s_a_g_e:

             data(ttst)
             data(ftst)
             data(gammatst)
             data(normtst)
             data(chisqtst)

_D_e_t_a_i_l_s:

     These tests values are tab-delimited ascii datasets, with a
     variable header line. Typical variables are:

     P - probablilty value DF - degrees of freedom INVDIST - inv the
     inverse function value for P: i.e.: invt(P,DF) = INVT INVDIST -
     inv the inverse function value for P: i.e.: invt(P,DF) = INVT
     PINVDIST - value for cumulative distribrution of INVDIST i.e.:
     cumt(INVT,DF) = PINVT

     Note that because of limits in numerical precision,
     cumt(invt(P,DF)) is not always equal to P

     Of course, not all possible values of P and DF can be listed. The
     test values for P  were created from systematic and random samples
     in  { [1e-12,1-1e-12],0,1 }, and [0,1E5] respectively.

     We use Kneusel's ELV program (1989) to calculate the values the
     cumulative and  inverse distributions. The results are claimed by
     Knsusel to be accurate to 6 digits. We checked these results using
     Brown's (1998) DCDFLIB library. The results of both calculations
     agreed to the 6 digits supplied by ELV, but in a small number of
     cases, DCDFSTAT's calculation at the 7th digit indicated that the
     sixth digit would change if rounded. 

     Note that both ELV and DCDFLIB can generate many more
     distributions than are included here. Other resources are
     described in the references

_V_a_l_u_e:

     Returns a new vector of log-relative-errors (log absolute error
     where $c_i$ ==0). The resulting values are roughly interpretable
     as the number of significant digits of agreement between c and x.
     Larger numbers indicate that x is a relatively more accurate
     approximation of c. Numbers less than or equal to zero indicate
     complete disagreement between x and c.

_A_u_t_h_o_r(_s):

     Micah Altman Micah_Altman@harvard.edu <URL:
     http://www.hmdc.harvard.edu/micah_altman/>, Michael McDonald

_R_e_f_e_r_e_n_c_e_s:

     Altman, M., J. Gill and M. P. McDonald.  2003.  _Numerical Issues
     in Statistical Computing for the Social Scientist_.  John Wiley &
     Sons. <URL: http://www.hmdc.harvard.edu/numerical_issues/>

     Altman, Micah and Michael McDonald, 2001. "Choosing Reliable
     Statistical Software."  _PS: Political Science & Politics_ 24(3):
     681-8

     Barry W. Brown, James Lovato, Kathy Russell, 1998,   DCDFLIB,
     <URL: ftp://odin.mda.uth.tmc.edu in pub/unix/dcdflib.c-1.0-tar.Z>

     Kneusel, L. 1989. _Computergesteutzte Berechnung statistischer
     Verteilungen._ Olde nbourg, Meunchen-Wien. <URL:
     http://www.stat.uni-muenchen.de/~knuesel/elv/elv.html>

_E_x_a_m_p_l_e_s:

     # simple LRE examples
     LRE(1.001,1) # roughly 3 significant digits agreement
     LRE(1,1) # complete agreement
     LRE(20,1) # complete disagreement

     #
     # how accurate are student's t-test functions?
     #

     data(ttst)
     # compute t quantiles using benchmark data
     tqt = qt(ttst$p,ttst$df)

     # compute log-relative-error (LRE) of  qt() results, compared to 
     # correct answers

     lrq = LRE(tqt, ttst$invt);

     # if there are entries with LRE's of < 5, there may be
     # significant inaccuracies in the qt() function

     table(trunc(lrq))

     # now repeat process, for pt()

     tpt = pt(ttst$invt,ttst$df)
     lrp= LRE(tpt, ttst$pinvt);
     table(trunc(lrp))

