

Note: The Average Deviation always equals zero. If you work with a simple example it is easy to see that this is so.
X M |X-M|
5 - 3 = 2
3 - 3 = 0
2 - 3 = 1
4 - 3 = 1
1 - 3 = 2
-----
6
MD = 6/5 = 1.2

X M (X-M) (X-M)2
5 - 3 = 2 4
3 - 3 = 0 0
2 - 3 = -1 1
4 - 3 = 1 1
1 - 3 = -2 4
---- -----
0 10
s2 = 10/(5-1) = 10/4 = 2.5
s = 1.58
Sample 1: mean = 90; s = 13; CV = 14.44 Sample 2: mean = 980; s = 130; CV = 13.27
Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------- classa | 30 49.9 4.710468 41 59 classb | 30 49.8 9.418983 32 68 classc | 30 55.8 4.536442 47 64
use http://www.philender.com/courses/data/hsb2, clear
summarize math, detail
math score
-------------------------------------------------------------
Percentiles Smallest
1% 36 33
5% 39 35
10% 40 37 Obs 200
25% 45 38 Sum of Wgt. 200
50% 52 Mean 52.645
Largest Std. Dev. 9.368448
75% 59 72
90% 65.5 73 Variance 87.76781
95% 70.5 75 Skewness .2844115
99% 74 75 Kurtosis 2.337319
return list
scalars:
r(N) = 200
r(sum_w) = 200
r(mean) = 52.645
r(Var) = 87.76781407035173
r(sd) = 9.368447794077294
r(skewness) = .2844114876115678
r(kurtosis) = 2.337319273907357
r(sum) = 10529
r(min) = 33
r(max) = 75
r(p1) = 36
r(p5) = 39
r(p10) = 40
r(p25) = 45
r(p50) = 52
r(p75) = 59
r(p90) = 65.5
r(p95) = 70.5
r(p99) = 74
display 100*r(sd)/r(mean) /* coefficient of variation */
17.795513
display r(max)-r(min) /* range */
42
display r(p75)-r(p25) /* interquartile range */
14
display (r(p75)-r(p25))/2 /* semi-interquartile range)
7
generate total = read + write + math
summarize read write math science socst total
Variable | Obs Mean Std. Dev. Min Max
---------+-----------------------------------------------------
read | 200 52.23 10.25294 28 76
write | 200 52.775 9.478586 31 67
math | 200 52.645 9.368448 33 75
science | 200 51.85 9.900891 26 74
socst | 200 52.405 10.73579 26 71
total | 200 157.65 25.21142 108 211
tabstat read write math science socst total, stat(n mean sd var range iqr) col(stat)
variable | N mean sd variance range iqr
-------------+------------------------------------------------------------
read | 200 52.23 10.25294 105.1227 48 16
write | 200 52.775 9.478586 89.84359 36 14.5
math | 200 52.645 9.368448 87.76781 42 14
science | 200 51.85 9.900891 98.02764 48 14
socst | 200 52.405 10.73579 115.2573 45 15
total | 200 157.65 25.21142 635.6156 103 39
--------------------------------------------------------------------------
Intro Home Page
Phil Ender, 30Jun98