Announcement

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

  • Error "weight not constant within id"

    Hi,

    I want to perform a survival analysis and see how human capital affects the unemployment duration that is already calculated in the variable stime. The thing is I can't declare my data to be survival-time data because when I check the box saying "Multiple-record ID variable" they return with the error "weight not constant within id".

    The code I am using is:
    stset stime [pweight = wt], id(id) failure(died==1)

    And here is how the data is structured:
    wt id stime died
    492.8779 1 8 0
    567.14383 1 9 0
    543.88678 1 10 0
    202.29983 2 2 0
    211.68756 2 4 0
    154.00905 2 5 0
    192.70173 3 4 0
    384.57381 4 . 0
    402.35655 4 . 0
    447.8705 4 . 0
    557.93722 4 10 0

    What should I do?
    Thanks

  • #2
    From the PDF documentation for stset we see

    Data warnings and errors flagged by stset
    When you stset your data, stset runs various checks to verify that what you are setting makes sense. stset refuses to set the data only if, in multiple-record, weighted data, weights are not constant within ID. Otherwise, stset merely warns you about any inconsistencies that it identifies.
    So the implication is that it does not make sense to have different weights on different records for the same ID. There does not seem to be a way around this. Again from the PDF documentation we see

    pweights are Stata’s sampling weights—the inverse of the probability that the subject was chosen from the population.
    I think you have tried to apply weights that are intended to allow you to reproduce population characteristics in a given wave of your data to time-varying populations. That is, in the wave at which ID 1 had 8 years of unemployment, they represented about 492 people at that time, but a year later, they represented 567 people at that time. But your weights, to make sense, need to tell you how many people ID 1 represented among those who could have been selected for inclusion in this data.

    I think you will have to do an unweighted analysis.

    Comment


    • #3
      Thanks William. So my only two alternatives are to do an unweighted analysis or to have the same weights for the same id, right?
      I saw another command with the prefix svy that works with weights. That wouldn't work either?

      Comment


      • #4
        I am no expert on the svy commands, but I think it is unlikely.

        Comment

        Working...
        X