Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • cii means poisson: #exposure must be integer. Why?

    Before the Stata update released on the 29 October 2015, the 95% exact confidence interval for a Standardized Mortality Ratio where, for example, 15 deaths were observed and 34.5 deaths were expected, could be obtained as follows (under the common assumption that the number of observed deaths follows a Poisson distribution):

    Code:
    version 14
    cii 34.5 15, poisson
    Following the 29oct205 update, this is no longer possible, because the #exposure argument (that is, the first argument) must be a positive integer. Therefore, the following code:

    Code:
    version 14.1
    cii means 34.5 15, poisson
    will return the following error message: first argument, #exposure, must be a positive integer.

    Could anyone explain to me the reasons behind this choice?

  • #2
    Andrea:
    your first code still works for me in Stata 14.1 (Current update level: 01 Feb 2016):
    Code:
    . cii 34.5 15, poisson
    
                                                             -- Poisson  Exact --
        Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
                 |       34.5    .4347826    .1122604        .2433445    .7171078
    whereas your second code does not:
    Code:
    . cii means 34.5 15, poisson
    means not found
    r(111);
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Odd, I get the same response as Andrea, and I, too, am updated to 1 Feb 2016:

      Code:
      . about
      
      Stata/MP 14.1 for Windows (64-bit x86-64)
      Revision 01 Feb 2016
      Copyright 1985-2015 StataCorp LP
      
      Total physical memory:     8269900 KB
      Available physical memory: 3264048 KB
      
      Single-user 2-core Stata perpetual license:
             Serial number:  REDACTED
               Licensed to:  Clyde Schechter
                             Albert Einstein College of Medicine
      
      . cii 34.5 15, poisson
      you must specify one of means, proportions, or variances following cii
      r(198);
      
      . cii means 34.5 15, poisson
      first argument, #exposure, must be a positive integer
      r(7);
      Is this a Windows vs Mac or Unix thing perhaps?

      And I agree with Andrea's objection: I can't think of any reason in principle why the exposure for a Poisson rate calculation should be constrained to integer values.

      Comment


      • #4
        Dear Andrea and Clyde:
        very odd indeed!

        Code:
        . about
        
        Stata/SE 14.1 for Windows (64-bit x86-64)
        Revision 01 Feb 2016
        Copyright 1985-2015 StataCorp LP
        
        Total physical memory:     8298808 KB
        Available physical memory: 5316556 KB
        As recommended by an old Statalist post (http://www.stata.com/statalist/archi.../msg00398.html) I omit licence details.
        Last edited by Carlo Lazzaro; 14 Feb 2016, 10:51.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Here's an explanation - not for the why the change was made, but for Carlo's and Clyde's apparent differing experience. I hypothesize that Carlo included the version 14 command in his initial run, which causes the second run to be diagnosed with a syntax error, since the mean clause was introduced in version 14.1.
          Code:
          . about
          
          Stata/SE 14.1 for Mac (64-bit Intel)
          Revision 01 Feb 2016
          Copyright 1985-2015 StataCorp LP
          
          . cii mean 34.5 15, poisson
          first argument, #exposure, must be a positive integer
          r(7);
          
          . version 14
          
          . cii 34.5 15, poisson
          
                                                                   -- Poisson  Exact --
              Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
          -------------+---------------------------------------------------------------
                       |       34.5    .4347826    .1122604        .2433445    .7171078
          
          . 
          . cii mean 34.5 15, poisson
          mean not found
          r(111);
          Last edited by William Lisowski; 14 Feb 2016, 12:01.

          Comment


          • #6
            William spotted the issue about my seeming success in running Andrea's first code. Thanks.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Yes, that mystery is solved.

              But Andrea's question about why the exposure is restricted to integer values remains unanswered. I can't think of any good reason for this; yet it was explicitly introduced as a change to the way the command works, so I imagine Stata Corp. has a reason for this. Generally if Stata prevents you from doing something, it's because there is something problematic about doing it. But in this case, the rationale escapes me. I hope someone from Stata Corp. will chime in on this.

              Comment


              • #8
                And now I've found the answer. Clyde's assurances in posts 3 and 7 gave me the confidence to look further. After examining cii.ado, I saw (a) where cii.ado checks that the first argument is an integer, and (b) that cii.ado seems to have a separate code base from ci.ado. So I duplicated our example from the "immediate" command cii by created a one-observation dataset and applying the ci command.
                Code:
                . about
                
                Stata/SE 14.1 for Mac (64-bit Intel)
                Revision 01 Feb 2016
                Copyright 1985-2015 StataCorp LP
                
                . version
                version 14.1
                
                . set obs 1
                number of observations (_N) was 0, now 1
                
                . generate n = 15
                
                . generate e = 34.5
                
                . ci means n, poisson exposure(e)
                
                                                                         -- Poisson  Exact --
                    Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
                -------------+---------------------------------------------------------------
                           n |       34.5    .4347826    .1122604        .2433445    .7171078
                I think this inconsistency needs to be brought to the attention of Stata Technical Support. I'll leave that to someone who actually uses the command; I don't.

                Comment


                • #9
                  The following reproducible example demonstrates the problem with the version of cii (but not ci) introduced in Stata 14.1.
                  Code:
                  about
                  clear
                  set obs 1
                  generate n = 15
                  generate e = 34.5
                  
                  version 14
                  ci n, poisson exposure(e)
                  cii 34.5 15, poisson
                  
                  version 14.1
                  ci means n, poisson exposure(e)
                  cii means 34.5 15, poisson
                  Code:
                  . about
                  
                  Stata/SE 14.1 for Mac (64-bit Intel)
                  Revision 01 Feb 2016
                  Copyright 1985-2015 StataCorp LP
                  
                  . clear
                  
                  . set obs 1
                  number of observations (_N) was 0, now 1
                  
                  . generate n = 15
                  
                  . generate e = 34.5
                  
                  .
                  . version 14
                  
                  . ci n, poisson exposure(e)
                  
                                                                           -- Poisson  Exact --
                      Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
                  -------------+---------------------------------------------------------------
                             n |       34.5    .4347826    .1122604        .2433445    .7171078
                  
                  . cii 34.5 15, poisson
                  
                                                                           -- Poisson  Exact --
                      Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
                  -------------+---------------------------------------------------------------
                               |       34.5    .4347826    .1122604        .2433445    .7171078
                  
                  .
                  . version 14.1
                  
                  . ci means n, poisson exposure(e)
                  
                                                                           -- Poisson  Exact --
                      Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
                  -------------+---------------------------------------------------------------
                             n |       34.5    .4347826    .1122604        .2433445    .7171078
                  
                  . cii means 34.5 15, poisson
                  first argument, #exposure, must be a positive integer
                  r(7);
                  
                  .

                  Comment


                  • #10
                    Andrea Discacciati discovered a bug in cii means, poisson. We were able to fix it for the Stata update that came out today (16feb2016). Please type
                    Code:
                    . update all
                    to update your Stata. Thank you!

                    Comment


                    • #11
                      Carlo, Clyde, William: thank you for looking into this.

                      Houssein: thank you very much for the extremely quick fix!

                      Comment

                      Working...
                      X