Announcement

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

  • Censored observation

    Hello,
    I have 1000 observations and I want to run a Cox model but I want to censored just one observation from those.
    i.e if my observations has ID from 1-1000 how can I isolate the one with ID=150?

  • #2
    Ioannis:
    you may want to try:
    Code:
    stcox <yourpredictors> if ID!=150
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Um, I don't think Carlo's advice is correct here. That code will exclude ID = 150 from the analysis. But the post requests turning it into a censored observation. So I would do it as:

      Code:
      gen byte failed = ID != 150
      stset event_time, failure(failed)
      and then run your analyses. Now ID 150, and only that observation, will be treated as censored as of event_time, rather than having experienced the failure event.

      Comment


      • #4
        Clyde is correct.
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          These are the commands that I use to create the event "ADev" and the time "ADev_tm":

          gen ADev=1 if AIDS==1 | Death==1
          replace ADev=0 if ADev==.
          gen ADev_tm=(min(AIDSdate,dth_da)-date0)/365.25 if ADev==1
          replace ADev_tm=(maxdate-date0)/365.25 if ADev==0

          How can I use these variables to your code?

          Comment


          • #6
            So I would do this:

            Code:
            gen failed = ADev
            replace failed = 0 if ID == 150
            stset ADev_tm, failure(failed)

            Comment


            • #7
              If I say this:

              replace ADev=0 if ID==150
              stset ADev_tm, failure(ADev)

              (I think the above is the same with yours)

              But its the same with this?

              replace ADev=0 if ID==150
              stset ADev_tm ADev
              Last edited by Ioannis Michalopoulos; 20 Jan 2018, 12:50.

              Comment


              • #8
                Well, that would be, in a sense, equivalent to what I showed. In the code I wrote, I preferred to create a new variable because, presumably ID 150 actually did develop AIDS or die but, for some reason you have not explained, you want to consider him/her a censored observation. So to change the value of ADev would be to make the data an incorrect representation of what happened. By making a separate variable, ADev retains an accurate recording of the development of AIDS or death, and the censoring of ID 150 is reflected, instead, in the separate variable failure. It's really more of a truth-in-labeling issue than a matter of getting the analysis wrong.

                Comment

                Working...
                X