Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: median average deviation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: median average deviation
Date   Thu, 6 Dec 2007 17:23:13 -0000

Like Eva, I suspect Syed is referring to the median 
_absolute_ deviation (from the median), recently 
known as the MAD, but known already to Gauss in 1816. 

In addition to Eva's very clear example of how to
do it from first principles, note that -egen- has
had a -mad()- function since Stata 7. 

Nick
n.j.cox@durham.ac.uk 

Eva Poen

Do you mean

sysuse auto, clear
qui sum price, detail
scalar median = r(p50)
gen deviation = abs(price - median)
qui sum deviation, detail
di "Median absolute deviation of the variable price is " r(p50)

drop deviation

?

Syed Gillani

> Is there a stata program doing median average deviation please?

*
*   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/



© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index