I was a bit dopey to multiply everything by 10000
and then average. That's in the formula, I was given,
but even so.
The program ended
gen double `HHI' = (100 * (`A' + `B') / `Stotal')^2
su `HHI', meanonly
}
di as txt "Schmalensee AVE_HHI " as res r(sum)
return scalar AVE_HHI = r(sum)
end
but would be better as
gen double `HHI' = ((`A' + `B') / `Stotal')^2
su `HHI', meanonly
}
di as txt "Schmalensee AVE_HHI " as res 10000 * r(sum)
return scalar AVE_HHI = 10000 * r(sum)
end
and even better without the factor 10000 altogether. The measure
is at root a probability, after all.
Nick Cox
[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/