Announcement

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

  • About calculating absolute incidence rate in poisson model

    Hi all,

    I'd like to estimate absolute incidence rate using poisson regression.

    I used following code:

    poisson outcome i.ssc sex1 year2 region, irr exp(persondays)
    margins ssc, predict(ir)


    However, my main independent variable "ssc" is a binary count variable. And Stata warnings:
    ssc: string variables may not be used as factor variables

    Then I destringed "ssc" and re-runed the codes, it worked.

    I was wondering is this destring appropriate? And could anyone explain what's the actual meaning of "exp(persondays)"?

    Thank you in advance!

    Best,
    Z


  • #2
    As the message says, ssc is stored as a string variable. Even if it only contains numbers, you need to convert it to a numeric variable to use it as a factor variable. In short, the destring is not only appropriate but neccessary.


    Your model is:

    log(rate) = xb

    log(events/persondays) = xb (where events is the total number of events (sum of outcome) for each covariate pattern)

    log(events) = xb + log(persondays)

    The outcome in Poisson regression is the number of events. When you are modelling rates, the log of person-time appears on the right-hand side. It is known as an offset. The syntax for the -poisson- command is to specify the offset using the exp() option. Other command use a different syntax (e.g., in -glm- you use the offset() or lnoffset() options).

    Comment


    • #3
      Originally posted by Paul Dickman View Post
      As the message says, ssc is stored as a string variable. Even if it only contains numbers, you need to convert it to a numeric variable to use it as a factor variable. In short, the destring is not only appropriate but neccessary.


      Your model is:

      log(rate) = xb

      log(events/persondays) = xb (where events is the total number of events (sum of outcome) for each covariate pattern)

      log(events) = xb + log(persondays)

      The outcome in Poisson regression is the number of events. When you are modelling rates, the log of person-time appears on the right-hand side. It is known as an offset. The syntax for the -poisson- command is to specify the offset using the exp() option. Other command use a different syntax (e.g., in -glm- you use the offset() or lnoffset() options).
      Thank you very much Paul! The explanation is super helpful!

      Comment

      Working...
      X