Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: [Re: How to program a loop to calculate the value of an observation]


From   n j cox <n.j.cox@durham.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: [Re: How to program a loop to calculate the value of an observation]
Date   Tue, 06 Feb 2007 17:43:11 +0000

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
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/



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