## Stata 15 help for lrecomp

```
Title

[P] lrecomp -- Display log relative errors

Syntax

lrecomp exp exp [exp exp [()] [exp exp [()] [...]]]

Description

lrecomp is used to make tables of the number of correctly estimated
digits (LREs) when comparing calculated results to known-to-be-correct
results.

In each pair of expressions, the first is the calculated result and the
second the known-to-be-correct result.

You may also include () to specify that the minimum LRE to that point be
reported.  Multiple ()s may be coded, and the minimum from the previous
() to the current () is reported.

Remarks

In reporting comparisons of calculated results with true results, it is
popular to report the LRE -- the log relative error.  Let c represent a
calculated result and t the known-to-be-correct answer.  The formal
definition of this comparison is

LRE  =   -log10(|c-t|)        if t == 0
=   -log10(|(c-t)/t|)    otherwise

The result of this calculation is then called "Digits of Accuracy" or,
more precisely, "Decimal Digits of Accuracy".

Double-precision calculations carry roughly 16.5 digits of accuracy so,
in theory, one should report min(16.5, LRE).  In practice, it has become
common to report min(15, LRE) because many certified results are
calculated to only 15 digits of accuracy.

In any case, lrecomp does not apply the minimum.  When c==t, lrecomp
displays "exactly equal".

Example

You have run a regression certification test and, among other results,
Stata has calculated _b[x1], the regression coefficient on variable x1.
The known-to-be-correct answer result is 1 and you wish to compare the
calculated _b[x1] to that.  You type:

. lrecomp _b[x1] 1
_b[x1]                11.7

_b[x1] was calculated to 11.7 digits.

If two regression coefficients were calculated, _b[x1] and _b[x2], and
both should be 1, you could type

. lrecomp _b[x1] 1 _b[x2] 1

_b[x1]                11.7
_b[x2]                10.0

If the standard errors of each of these coefficients were also known to
be 1, you might type

. lrecomp _b[x1] 1 _b[x2] 1 _se[x1] 1 _se[x2] 1

_b[x1]                11.7
_b[x2]                10.0
_se[x1]               <exactly equal>
_se[x2]               <exactly equal>

or you could type

. lrecomp _b[x1] 1 _b[x2] 1 () _se[x1] 1 _se[x2] 1 ()

_b[x1]                11.7
_b[x2]                10.0
--------------------------
min                   10.0

_se[x1]               <exactly equal>
_se[x2]               <exactly equal>
--------------------------
min                   15.0

When all results are exactly equal, () arbitrarily reports 15.0 for the
min.

```