Hi all,

this is my first post here. I am currently doing my master thesis. As part of this, I would like to calculate the Herfindahl-Hirschman Index for the following scenario. To understand what I am talking about, I have attached a table. The first column depicts different IDs, e.g. the first five rows have the same ID. The second column depicts different regions for the corresponding ID. I would now like to calculate the HHI index based on these two columns. I computed the HHI index manually and have attached it as a third column to show the results that I would like to have. My real data set, however, encompasses >5000 rows. As can be seen from the HHI results, I want to compute a separate HHI_region for each ID.

So far I have tried different commands, such as "hhi Region, by(ID)", however the results I get are wrong.

If anyone can help me out, this would be great.

Thank you for help.

Best regards,

Filipp

this is my first post here. I am currently doing my master thesis. As part of this, I would like to calculate the Herfindahl-Hirschman Index for the following scenario. To understand what I am talking about, I have attached a table. The first column depicts different IDs, e.g. the first five rows have the same ID. The second column depicts different regions for the corresponding ID. I would now like to calculate the HHI index based on these two columns. I computed the HHI index manually and have attached it as a third column to show the results that I would like to have. My real data set, however, encompasses >5000 rows. As can be seen from the HHI results, I want to compute a separate HHI_region for each ID.

So far I have tried different commands, such as "hhi Region, by(ID)", however the results I get are wrong.

If anyone can help me out, this would be great.

Thank you for help.

Best regards,

Filipp

ID | Region | HHI_region |

1 | 1 | 0.36 |

1 | 2 | 0.36 |

1 | 2 | 0.36 |

1 | 3 | 0.36 |

1 | 3 | 0.36 |

2 | 1 | 0.55 |

2 | 1 | 0.55 |

2 | 2 | 0.55 |

3 | 1 | 1 |

## Comment