1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
* Zipf's law (see http://linkage.rockefeller.edu/wli/zipf/). 
* Want to graph log of freq versus log of rank.

GET FILE='c:\\program files\\spss\\world95.sav'.

* Suppose we want to test the frequency of religion.
AGGREGATE
  /OUTFILE=*
  /BREAK=religion
  /freq = N(region).

RANK
  VARIABLES=freq  (D) /RANK INTO rank1 /PRINT=YES
  /TIES=MEAN .

COMPUTE lnfreq=LN( freq).
COMPUTE lnrank=LN(rank1).

GRAPH
  /SCATTERPLOT(BIVAR)=lnrank WITH lnfreq
  /MISSING=LISTWISE.