Zun
> Sorry I did not describe the data. The two vars are part of a huge
> dataset that has more than 100,000 observations. What I
> really want to do
> is to use the percentages as weights to adjust for regression
> coefficients. That is, I ran a regression on logincome with
> about 70
> independent vars, 52 of which are dummies for industry. I save the
> coefficients for these dummies as b1-b52 and then obtain
> the percentage
> for each industry as p1-p52. The final product I want is
> the standard
> deviation of the industry effects calculated by:
> let i=1/52
> egen mubar=sum(b`i' * p`i')
> egen variance=sum(p`i' * ((b`i'- mubar)^2) )
> gen sd=sqrt(variance)
>
> I can get p`i' by counting the N for the whole sample and
> then counting
> N`i' for each industry so that p`i'=N`i'/N. But this takes
> a lot of time
> becuase I need to generate 52 dummy variables. I am
> wondering if there is
> a faster way of doing this. Thanks very much.
Sorry, this is less clear to me than before.
I can't tell (1) what you have actually done
and (2) what you are imagining doing. In
addition, some of your Stata syntax won't work.
Perhaps someone else can figure out what you
want.
Nick
n.j.cox@durham.ac.uk
*
* 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/