donderdag 22 oktober 2015

Stata code for Herfindahl concentration index

Herfindahl concentration index

The Herfindahl concentration index computes a score between 0 (total dispersion) and 1 (total concentration) which is the sum of all squared shares within a unit.

In the working example hours per job for workers are used.

tempvar t1
egen `t1' = total(hours), by(workerid year)
tempvar t2
gene `t2' = (hours / `t1')^2
egen herfindahl = total(`t2'), by(workerid year)
drop `t1' `t2'
label var herfindahl "Herfindahl concentration index"