*! version 1.1.0 14July2026
help zipfbend

.-
help for zipfbend (R Bergs, 14July2026)
.-

Title

zipfbend -- Calculates the transition point between an upper Pareto and a lower log-normal tail in rank-size distributions (Rank - 0.5) and Kolmogorov-Smirnov test for city sizes

Syntax

zipfbend varname in [, generate(newvar)]

Description

zipfbend estimates the parameters of a Zipf (Power Law) distribution using
the modified log rank-size OLS regression:
ln(Size) = alpha + beta * ln(Rank - 0.5).

The command automatically drops missing and non-positive values before estimation.
It identifies a structural "bend point" where the empirical log-rank deviates
maximally (positive distance) from the OLS-predicted log-rank. It also performs a
manual Kolmogorov-Smirnov (KS) goodness-of-fit test against a theoretical Pareto
distribution based on the estimated alpha and beta coefficients.

Options

generate(newvar) creates a new variable in the original dataset
containing the calculated difference between the observed log-rank and the
OLS-estimated log-rank (x_obs - x_est).

Results

zipfbend displays the following:

Scalars

number of observations

estimated Zipf coefficient (b)

implied Pareto exponent (-1/b)

maximum positive difference between observed and estimated log-rank

rank corresponding to the bend point

item size at the bend point

calculated Kolmogorov-Smirnov test statistic (D)

approximate critical value for KS test (alpha = 0.05)

Examples

. zipfbend city_pop in 1/100

. zipfbend city_pop if city_pop>10000 in 10/50, generate(zipf_deviation)

Author

R Bergs