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

st: RE: Probable bug in -ci-


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Probable bug in -ci-
Date   Sat, 8 May 2004 19:18:18 +0100

I think Fred is correct. At first glance, the 
problem lies in the code 

	if _by() & _bylastcall() & "`total'"!="" {
		di _n in gr _dup(79) "_" _n "-> Total"
		if "`level'"!="" {
			local level "level(`level')"
		}
		if "`exposur'"!="" {
			local exposur "exposure(`exposur')"
		}
		ci `varlist' if `alluse' `weight', /*
			*/ `level' `poisson' `binomia' `exposur'
		return clear
		ret add
	}

in which the lines 

	if "`exposur'"!="" {
			local exposur "exposure(`exposur')"
	}

have the effect (in his case) of converting the option 
call internally to 

	exposure(ex(duration)) 

The error message doesn't really point in the right 
direction here. 

Fred Wolfe
 
> There appears to be a bug in -ci- when the by option AND the 
> total option 
> is used, as shown below.
> 
> . ci firstcataract if lpuse == 1,exposure(duration)
> 
>                                                           -- 
> Poisson  Exact --
>      Variable |   Exposure        Mean    Std. Err.       
> [95% Conf. Interval]
> -------------+------------------------------------------------
> ---------------
> firstcatar~t |      46209    .0077907    .0004106        
> .0070066    .0086385
> 
> 
> 
> 
> -> sex = Female
> 
>                                                           -- 
> Poisson  Exact --
>      Variable |   Exposure        Mean    Std. Err.       
> [95% Conf. Interval]
> -------------+------------------------------------------------
> ---------------
>      cataract |      10369    .0058829    .0007532        
> .0044999    .0075568
> 
> -> sex = Male
> 
>                                                           -- 
> Poisson  Exact --
>      Variable |   Exposure        Mean    Std. Err.       
> [95% Conf. Interval]
> -------------+------------------------------------------------
> ---------------
>      cataract |      35840    .0083426    .0004825        
> .0074237    .0093439
> 
> 
> 
> . bys sex: ci cataract if lpuse == 1,exposure(duration)  total
> 
> -> sex = Female
> 
>                                                           -- 
> Poisson  Exact --
>      Variable |   Exposure        Mean    Std. Err.       
> [95% Conf. Interval]
> -------------+------------------------------------------------
> ---------------
>      cataract |      10369    .0058829    .0007532        
> .0044999    .0075568
> 
> 
> -> sex = Male
> 
>                                                           -- 
> Poisson  Exact --
>      Variable |   Exposure        Mean    Std. Err.       
> [95% Conf. Interval]
> -------------+------------------------------------------------
> ---------------
>      cataract |      35840    .0083426    .0004825        
> .0074237    .0093439
> 
> ______________________________________________________________
> _________________
> -> Total
> time-series operators not allowed
> in option exposure()
> r(101);

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