```.-
help for ^ineq^
.-

Measures of inequality
----------------------

^ineq^ varname [^if^ exp] [^in^ range] [weight]
[, ^n^umeq ^by(^byvarlist^) gens^im^(^newvar^) gene^nt^(^newvar^)^
^gend^iss^(^newvar^)^ tabdisp_options ]

Description
-----------

^ineq^ treats varname as an additive variable -- that is, assumes totals
make sense and that no negative values are present in the data specified
-- and calculates three measures of inequality.

Given n values of y, scale to proportions p = y / SUM y. Then

Simpson's index is SUM p^^2. If one value of p is 1, and the others thus
all 0, this index takes on a maximum value of 1. If all p are 1 / n, it
takes on a minimum value of 1 / n.

Shannon entropy is - SUM p ln p = SUM p ln 1/p. If one value of p is 1,
this index takes on a minimum value of 0. If all p are 1 / n, it takes
on a maximum value of ln n.

Dissimilarity index is (1 / 2) SUM | p - 1 / n |. If one value of p is
1, this index takes on a maximum value of (n - 1) / n. If all p are 1 /
n, it takes on a minimum value of 0.

These measures are known under a variety of names, and a variety of
related guises, in different fields.

fweights and aweights are allowed.

Options
-------

^by(^byvarlist^)^ specifies that calculations should be performed
separately for groups defined by byvarlist.

^numeq^ specifies that Simpson's index and entropy are to be converted
to number equivalents, namely 1 / Simpson's index and exp(entropy).

^gensim( )^, ^genent( )^ and ^gendiss( )^ specify that new variables
should be generated containing values of the three measures.

tabdisp_options are options of ^tabdisp^ controlling the tabulation of
results. The default is ^format(%4.3f)^.

Examples
--------

. ^ineq income^

Author
------

Nicholas J. Cox, University of Durham, U.K.
n.j.cox@@durham.ac.uk

Also see
--------

On-line: help for @tabdisp@

```