Announcement

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

  • Exact Poisson regression with weights

    Dear Stata users,

    The command expoisson gives different results when the same covariates are specified in a different order.
    Example:

    . use http://www.stata-press.com/data/r13/cerebacc
    (cerebrovascular accidents in hypotensive-treated and control groups)

    . set seed 1234
    . gen n = int(uniform()*10)

    .
    . expoisson count treat age [fw=n], nolog

    Exact Poisson regression
    Number of obs = 34
    ---------------------------------------------------------------------------
    count | Coef. Suff. 2*Pr(Suff.) [95% Conf. Interval]
    -------------+-------------------------------------------------------------
    treat | -1.870824 13 0.0000 -2.541112 -1.281398
    age | -.4106672 9 0.4479 -1.373402 .4943485
    ---------------------------------------------------------------------------

    . expoisson count age treat [fw=n], nolog

    Exact Poisson regression
    Number of obs = 34
    ---------------------------------------------------------------------------
    count | Coef. Suff. 2*Pr(Suff.) [95% Conf. Interval]
    -------------+-------------------------------------------------------------
    age | -.4437372 48 0.0168 -.8213309 -.0760211
    treat | -1.254544 4 0.0275 -2.675837 -.1131803
    ---------------------------------------------------------------------------


    Any clarification would be welcome.
    Thank you very much!

  • #2
    I have been able to replicate that behaviour. Without weights the order does not matter, and the coefficient and their statistics is equal to the those of the variable mentioned first in the model with weights:

    Code:
    use http://www.stata-press.com/data/r13/cerebacc, clear
    set seed 1234
    gen n = int(uniform()*10)
    expoisson count treat age [fw=n], nolog
    expoisson count age treat [fw=n], nolog
    
    expand n
    keep if n > 0
    
    expoisson count treat age , nolog
    expoisson count age treat , nolog
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you Maarten,

      I have also expanded the data in my analysis because I observed this behavior of the weights in the expoisson command (so does exlogistic).
      My question is whether this is a bug in these commands or have to do something to apply them correctly.

      Comment


      • #4
        This is a bug in -expoisson-. While we work out the problem, avoid using fweights and expand your data before calling -expoisson-.

        Comment


        • #5
          In regard to Llorenc's statement that the fweights problem also occurs in exlogistic, I cannot reproduce the problem in exlogistic. An example demonstrating the problem in exlogistic would be appreciated.

          expoisson expands the data within the ado code before calling an internal routine. It was not expanding the data properly and I have a fix for that. The estimates for the expanded data are okay. I have checked them with an external program.

          Comment


          • #6
            Sorry, I was wrong with exlogistic. This problem only occurs with expoisson with weights for all estimated coefficients except the first. Thank you very much for your quick response.

            Comment

            Working...
            X