Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: Tab and Matcell


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: Tab and Matcell
Date   Thu, 13 Jun 2002 15:59:57 +0100

Fraser, Steven
> >
> > I am having a problem implementing matrix operations within the 'tab'
> > command.  Using a variation of the familiar car example, assume 
> I have the
> > following dataset:
> >
> > Manuf Model Class MPG
> > ford explorer SUV 12
> > ford expedition SUV 10
> > ford focus compact 34
> > dodge durango SUV 16
> > gm tahoe SUV 15
> >
> > Assume I have hundreds of automobiles (cars, trucks, and SUVs).  I am
> trying
> > to develop a focus measure (a Herfandahl index) that captures 
> the focus of
> > the manufacturer.  For example, GM (with all the GM lines) 
> would probably
> > have a lower focus measure, while Volkswagon, which doesn't make any
> trucks
> > or SUVs, would have a higher focus measure.  What I need is the 
> frequency
> of
> > each class which will be different for each manufacturer.
> >
> > My approach has been
> >
> > sort manuf
> > by manuf: tab class, matcell(classmat)
> > mat list classmat
> >
> > Part 1 of my question:  The resulting matrix is only for the 
> last 'manuf'.
> > It will not allow "by:"  Can I incorporate as part of a loop?
> > Part 2 of my question:  I then need to access the variables and perform
> > calculations.  Would it be possible to put all the results in 
> one matrix?

The Herfindahl index can be calculated using -ineq- 
from SSC and, very probably, using other programs 
for inequality and similar analyses. -ineq- calls 
it the Simpson index, reflecting ecologists' rather
than economists' tribal jargon. 

Nick 
[email protected] 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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