Announcement

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

  • Confidence intervals for percent change

    Dear all,

    This question might sound stupid but I can't find the way to calculate 95%CI for percent change between frequencies (but not between proportion).

    For example:
    9630 events in year X
    6754 events in year Y
    percent change = (9630-6754)/9630= -30%

    How can I calculate the 95%CI of the percent change without having the denominator for these events?

    Many thanks for your help!

    Kind regards,

    Manon

  • #2
    Strictly speaking your question has no answer. Or rather, it has infinitely many answers, because a confidence interval relies on some underlying model distribution, and you have not specified one. On the assumption that you would find an underlying Poisson distribution for the count of events satisfactory for your purposes, you could do this:
    Code:
    clear
    set obs 2
    gen x = 9630 in 1
    replace x = 6754 in 2
    gen prepost = _n-1
    
    poisson x i.prepost, irr
    
    nlcom 100*(1-exp(_b[1.prepost]))
    Last edited by Clyde Schechter; 31 Jul 2022, 17:01.

    Comment


    • #3
      Dear Clyde,

      Thanks a lot for your answer, it helps me a lot!

      Manon

      Comment


      • #4
        Hi there

        Would this be appropriate for determining a percent change for a rate as well? I have units of medication dispensed as a numerator and the population at different time points as the denominator.
        For instance: time period 1: units dispensed = 1318539, population = 813,105; time period 2: units dispensed = 2112385, population = 820178

        Thanks in advance

        Comment


        • #5
          No, the code in #2 is specifically for calculating a change in a count, not in a rate.

          Yours just requires a little arithmetic, which you can do by hand, or you could do in Stata as
          Code:
          scalar units1 = 1318539
          scalar population1 = 813105
          
          scalar units2 = 2112385
          scalar population2 = 820178
          
          forvalues i = 1/2 {
              scalar rate`i' = units`i'/population`i'
          }
          
          scalar pct_change_in_rate = 100*(rate2-rate1)/rate1
          
          display %3.2f =pct_change_in_rate

          Comment


          • #6
            Thanks very much. How do you derive a 95% CI for the percent change for rates?

            Comment


            • #7
              Are you doing this for lots of data or just 2 numbers?

              Comment


              • #8
                Thanks. Comparing a percent change in rates between two points in time only. I was wondering if there was a way to get the 95% CI of the percent change in rates.

                Comment


                • #9
                  As with the response in #2, to calculate a confidence interval you must posit some underlying model of the data generating process. Here, again, I will use the Poisson model.
                  Code:
                  * Example generated by -dataex-. For more info, type help dataex
                  clear
                  input long(population units) byte group
                  813105 1318539 1
                  820178 2112385 2
                  end
                  
                  poisson units i.group, exposure(population)
                  nlcom 100*(exp(_b[2.group] - 1))

                  Comment


                  • #10
                    Between two points for multiple cross sections or just two points period? Can't get a confidence interval for just 2 points, but can for multiple cross sections.

                    If multiple observations (as Clyde is thinking), then poisson makes sense, but -ci proportions- might work as well.

                    Comment


                    • #11
                      Thanks for responses. Sorry, yes, for multiple cross sections.

                      Comment


                      • #12
                        Hi again
                        I may be being obtuse, or this may reflect my lack of familiarity with Stata, but I seem to be getting incorrect results. For example, using the approach above for the following:
                        input long(population units) byte group 2059597 389495 1 2121653 308254 2 end poisson units i.group, exposure(population) nlcom 100*(exp(_b[2.group] - 1)) The percent change is given as 28.3%. However, if done with simple arithmetic, the percent change is actually -23.2% (same if done with the first approach provided). Am I doing something wrong? Sorry to bother you, but appreciate your insights.

                        Comment


                        • #13
                          Sorry, there is an error in the code I showed in #9--one of the parentheses is misplaced, and that is the cause of the problem. The -nlcom- command should be
                          Code:
                          nlcom 100*(exp(_b[2.group])-1)
                          Last edited by Clyde Schechter; 18 Nov 2022, 13:58.

                          Comment


                          • #14
                            That works! Thanks very much for your patience and help. It is wonderful to have access to a community of people so willing to volunteer their time and knowledge.

                            Comment

                            Working...
                            X