# Re: st: about -mreldif( )-

 From wgould@stata.com (William Gould, Stata) To statalist@hsphsun2.harvard.edu Subject Re: st: about -mreldif( )- Date Thu, 09 Jun 2005 14:19:47 -0500

```Katsuhide Isa <katu@ier.hit-u.ac.jp> noted that Stata's (misnamed)
reldif(X,Y) function returns r,

|X - Y|
r =  ---------
|Y| + 1

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
wgould@stata.com
*
*   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/
```