[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: about -mreldif( )-
Katsuhide Isa <email@example.com> 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 = ---------
lim r = r_a
lim r = r_r
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.
* For searches and help try: