How Accurate is ViewHAR?


If you are looking at a 3 or 4 dimensional matrix with 6 decimal places, you may notice that when you change which dimension you are summing over, the matrix total changes.

This is not a bug - it reflects the fact that computer arithmetic has only limited precision. Consequently, subtotals of higher-dimensional matrices will always depend on the order in which they are calculated.

Usually GEMPACK fortran-based programs (non-windows) use single precision so that only the first 6 or so non-zero digits in a number are significant. A single has size 32 bits. Numbers in HAR files are stored in single precision.

More details at: www.copsmodels.com/gpnumacc.htm

Excel uses double-precision throughout, so that the first 12 or so non-zero digits in a number are significant.  A double has size 64 bits.

If GEMPACK fortran-based programs used double precision throughout, to solve a given model would require twice as much memory and take maybe twice as long.

64-bit versions of ViewHAR (and other GEMPACK Windows programs) use double precision throughout (like Excel).

The comments below apply only to 32-bit ViewHAR:

ViewHAR uses a mixture of single and double precision to calculate totals. Its accuracy is between that of GEMPACK and Excel.

Any differences between ViewHAR totals and those calculated by Excel are insignificant at single precision and so should not affect your GEMPACK (Fortran) simulations. The actual HAR files on disk do not include sub-totals and store only single-precision numbers [the totals are just computed by ViewHAR for you to look at].

In more detail

Suppose you are looking at a 2 dimensional subtotal of a 5-dimensional matrix. ViewHAR computed it as follows.

Using double-precision, the original (single-precision) matrix is added up in one dimension to get a 4-dimensional matrix A. This is converted to single precision and stored.

Next, using double-precision, the matrix A is added up in one dimension to get a 3-dimensional matrix B. This is converted to single precision and stored.

Next, using double-precision, the matrix B is added up in one dimension to get a 2-dimensional matrix C. This is stored in double precision and shown to you, with row and column totals also calculated in double precision.

In other words, all computations are performed in double precision except that those intermediate results which have 3 or more dimensions are stored in single precision.

See also: Number of Decimal Places



URL of this topic: www.copsmodels.com/webhelp/viewhar/hc_accuracy.htm

Link to full GEMPACK Manual

Link to GEMPACK homepage