Katsuhide Isa <[email protected]> noted that Stata's (misnamed)
reldif(X,Y) function returns r,
|X - Y|
r = ---------
|Y| + 1
and asked about the mathematical justification for this formula.
The formula is simply a mix of the absolute difference,
r_a = |X - Y|
and the relative difference
|X - Y|
r_r = ---------
|Y|
In particular,
lim r = r_a
Y->0
lim r = r_r
Y->inf
When Y is small, then r is approximately the absolute difference (r is
exactly the absolute difference when Y==0), and when Y is large, then
r is approximately the relative difference.
This function is often used in numerical programming to test whether a
value has changed much from one iteration to the next, and when one
does not know whether the paramter will be large or small.
-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/