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

st: RE: How to know how a global macro was generated: -smr- as an example

From   "Nick Cox" <>
To   <>
Subject   st: RE: How to know how a global macro was generated: -smr- as an example
Date   Thu, 11 Dec 2008 21:39:23 -0000

I guess I lay down the law on what is, and what is not, good practice so
frequently that I should be the last one to demur about somebody else
doing that. 

But I don't accept, personally, that all users who write Stata software
have an obligation to explain the formulae they use, even indirectly by
referencing. That is Utopian and impractical. (What if the references I
give do not explain all the ideas that I use, which will be very

That aside, one good practice not followed here is to explain where the
(user-written) code discussed comes from. 

STB-29  sg29.1  . . . Tabulation of observed/expected ratios & conf.
        (help smrby if installed) . . . . . . . . . . . . . . . . . P.
        1/96    pp.21--24; STB Reprints Vol 5, pp.87--90
        improved version of smr

Looking at -smrby- I note that 

1. -smrby- itself does not define any globals. 

2. Just before they are used, -smrby- calls -_crccip-. 

3. _crccip.ado is part of the Stata distribution. Commands whose names
begin with _crc are short utilities written by the Stata developers.
(CRC is the abbreviation for the original name of StataCorp.) 

4. So look inside _crccip.ado. 


Tiago V. Pereira

Not rarely I almost drive myself crazy because several Stata commands
to provide info about the formulations they use to compute
variances/standard errors in their calculations.

I have already claimed that most Stata packages should provide
on their formulae/and or to point out where we can get detailed info on
the methods implemented.

When no reference is given, I usually open the code and see how it was
calculated, trying to find ou in textbooks similar formulations.

However, in the case of the -smrby- command, which calculates the ratio
OBSERVED/EXPECTED counts and its confidence intervals, I could not
out how the global macros S_1 and S_2 were computed.

Once you can rapidly take a look on the code of the -smr- command, I did
not paste the whole code here for simplicity.

Specifically, I am interested in the following lines:

if _rc==0 {
		_crccip `o' `level'
		local l=100*($S_1/`e')
		local u=100*($S_2/`e')
		local r=100*(`o'/`e')
		local emark ""

I will be really grateful for any tip on how both $S_1 and $S_2 were

*   For searches and help try:

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