help for mads Version 4.0 May 10, 2018

mads

:

A utility to calculate Median Absolute Deviations

With kind advice from Dr. Nicholas J. Cox, University of Durham, U.K.

mads
[varlist]
[if exp]
[in range]
[weight]
[,
allobs
format(numeric_format(s))
matname(matrix_name)
tabdisp_options
variablenames
]

mads
varname
[if exp]
[in range]
[weight]
[,
allobs
by(varlist)
format(numeric_format(s))
matname(matrix_name)
tabdisp_options
]

by ... : may be used with mads:
see help on by.

aweights and fweights are allowed; see help
weights.

Description

mads calculates mean, standard deviation, median and
median absolute deviation for varlist. Any string variables in varlist are
ignored.

Options

allobs specifies use of the maximum possible
number of observations for each variable. The default is to
use only those observations for which all variables in
varlist are not missing.

by() specifies one or more variables defining distinct groups
for which mads should be calculated. by() is allowed
only with a single varname.

format() controls the display format of mean, standard
deviation, median and mad: up to four numeric formats may be given for
the four statistics respectively.
Formats not specified default to %9.3f.

matname() specifies the name of a matrix in which to save
the results of (the last set of) calculations. There will be 5 columns.
The columns will contain n, mean, standard deviation, median
and mad.

tabdisp_options are options of tabdisp
other than format().

variablenames specifies that the variable names of varlist
should be used in display. The default is to use variable labels to indicate a
set of variables.

Examples

. mads price

. mads price-foreign

. mads price-foreign, format(%5.1f %5.1f)

. mads price, by(foreign)

. mads price, by(rep78)

. bysort rep78: mads mpg

. bysort foreign: mads price, by(rep78)

. mads price if rep78 == 5, by(foreign)

uses logic and code snippets from moments.ado and .sthlp files.

Author

Basharat Hussain

bhgillani@gmail.com