[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Martin Weiss" <Martin.Weiss1@gmx.de> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: calculate concentration ratio of four firms |

Date |
Sun, 27 Dec 2009 21:31:58 +0100 |

<> Here is a worked example for you. Try it carefully, and see whether it really does what you want: *** clear* //three sectors set obs 3 gen byte sector =_n //expand to firm level expand 10 bys sector: gen byte firmid=_n //expand to time dimension expand 4 bys sector firmid: gen year =2002+_n //get sales data from normal distr gen double sales=rnormal(1000000,300000) //unbalance the thing! replace sales=. if runiform()<.1 //"1stly, total sales of industry j at time t (Yjt)" bys sector year: egen double totsalesjt=total(sales) //"2ndly, share of a firm i in //industry j (sales of firm i/Yjt)*100=a" gen shareoffirm=(sales/totsalesjt)*100 //check shares for consistency total shareoffirm, over(sector year) //"3rd a^2 for each firm at time t" gen double asquared=shareoffirm^2 //"4 step is problematic" (bear in mind unbalanced form!) bys sector year: egen nonmiss=count(shareoffirm) bys sector year: gen start=nonmiss-3 bys sector year (shareoffirm): /* */ egen firstfourtotal= /* */ total(((_n>=start)&(_n<=nonmiss))*shareoffirm) *** HTH Martin -------- Original-Nachricht -------- > Datum: Sun, 27 Dec 2009 16:42:54 +0200 (EET) > Von: "Alper [iso-8859-9] Sönmez" <salper@metu.edu.tr> > An: statalist@hsphsun2.harvard.edu > Betreff: st: calculate concentration ratio of four firms > Hi, I want to calculate the first four firms share in each industry at > time t (HHI4 or CH4). I calculated the shares but i cannot sum first four > firms shares in each industry at time t. > I tried egen and gen commands with several functions but they were not > worked > Also i did not find any solution or material from stata books and online > resources > I have an Unbalanced firm level panel data with variables id, years(t) > 2003-2006, and 2digitsectors(Sector)and it is in long form > > The problem: > I calculated > 1stly, total sales of industry j at time t (Yjt) > 2ndly, share of a firm i in industry j (sales of firm i/Yjt)*100=a > 3rd a^2 for each firm at time t > > 4 step is problematic: I can not calculate shares of first four firms in > sector j at time t > like this max(a+a+a+a) by (sector year) and write this value for firms in > these sector and year > > Please help me, > > in advance thanks, > > > > > > -- > Alper Sönmez > > ODTÜ/METU > ÝÝBF Ýktisat Bölümü/FEAS Department of Economics > Ankara Türkiye > Tel/Phone:0312 210 30 77 > Fax: 0312 210 79 64 > > > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ -- Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.! http://portal.gmx.net/de/go/dsl02 * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: calculate concentration ratio of four firms***From:*"Alper [iso-8859-9] Sönmez" <salper@metu.edu.tr>

- Prev by Date:
**Re: st: calculate concentration ratio of four firms** - Next by Date:
**st: gllamm and computational speed** - Previous by thread:
**Re: st: calculate concentration ratio of four firms** - Next by thread:
**Re: st: calculate concentration ratio of four firms** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |