Announcement

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

  • stset error: length[_n-1]==length

    Dear Statalist users,

    I am running a conditional risk set model (time from previous event) for the time to adoption of a technology using Stata IC 15.1.

    I have a dataset with multiple failures per subject. The period of observation is 2000-2017, with subjects entering the risk set at different years (i.e. not everyone became aware of the technology at t=0)

    I initially used stset as follows:

    stset length, fail(event==1) exit(time .)

    failure event: event == 1
    obs. time interval: (0, length]
    exit on or before: time .

    ------------------------------------------------------------------------------
    2,355 total observations
    0 exclusions
    ------------------------------------------------------------------------------
    2,355 observations remaining, representing
    2,094 failures in single-record/single-failure data
    4,963 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = 0
    last observed exit t = 17
    But then I realized I needed to modify the stset instruction to allow for multiple failures per subject:

    stset length, fail(event==1) enter(time0) exit(time .) id(idd)

    id: idd
    failure event: event == 1
    obs. time interval: (length[_n-1], length]
    enter on or after: time time0
    exit on or before: time .

    ------------------------------------------------------------------------------
    2,355 total observations
    1,803 multiple records at same instant PROBABLE ERROR
    (length[_n-1]==length)
    ------------------------------------------------------------------------------
    552 observations remaining, representing
    467 subjects
    308 failures in multiple-failure-per-subject data
    2,789 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = 0
    last observed exit t = 17
    I don't understand how to fix this PROBABLE ERROR. Perhaps I can attribute this to some subjects failing every single year (e.g. subject i adopted technology in year 2001, then again in 2002, then again in 2003). But I am unsure how to fix this problem.

    My data looks as follows:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int idd float(time0 length) byte(event interval)
     2 0 10 1  1
     2 0  1 1  2
     2 0  1 1  3
     2 0  1 1  4
     2 0  1 1  5
     2 0  1 1  6
     2 0  1 1  7
     2 0  1 1  8
     3 0 .5 1  1
     3 0  1 1  2
     3 0  1 1  3
     3 0  1 1  4
     3 0  1 1  5
     3 0  1 1  6
     3 0  1 1  7
     3 0  1 1  8
     3 0  1 1  9
     3 0  1 1 10
     3 0  1 1 11
     4 0  2 1  1
     4 0  1 1  2
     4 0  1 1  3
     4 0  1 1  4
     4 0  1 1  5
     5 0  6 0  1
     6 0  3 1  1
     6 0  1 1  2
     6 0  1 1  3
     6 0  1 1  4
     7 0  5 1  1
     7 0  1 1  2
     7 0  1 1  3
     7 0  1 1  4
     7 0  1 1  5
     7 0  1 1  6
     7 0  1 1  7
     8 0 .5 1  1
     8 0  1 1  2
     8 0  1 1  3
     8 0  1 1  4
     8 0  1 1  5
     8 0  1 1  6
     8 0  1 1  7
     8 0  1 1  8
     8 0  1 1  9
     8 0  1 1 10
     8 0  1 1 11
     8 0  1 1 12
     9 0  5 1  1
     9 0  1 1  2
     9 0  1 1  3
     9 0  1 1  4
    10 0 .5 1  1
    10 0  1 1  2
    10 0  1 1  3
    10 0  1 1  4
    10 0  1 1  5
    10 0  1 1  6
    10 0  1 1  7
    11 0  3 1  1
    11 0  1 1  2
    11 0  1 1  3
    11 0  1 1  4
    11 0  1 1  5
    11 0  1 1  6
    11 0  1 1  7
    11 0  1 1  8
    11 0  1 1  9
    12 0  2 1  1
    12 0  1 1  2
    12 0  1 1  3
    12 0  1 1  4
    12 0  1 1  5
    12 0  1 1  6
    13 0 .5 1  1
    13 0  1 1  2
    13 0  1 1  3
    13 0  1 1  4
    14 0 14 1  1
    14 0  1 1  2
    14 0  1 1  3
    14 0  1 1  4
    15 0  9 1  1
    15 0  1 1  2
    15 0  1 0  3
    16 0  3 1  1
    16 0  1 1  2
    16 0  1 1  3
    16 0  1 1  4
    17 0 10 1  1
    17 0  1 1  2
    17 0  1 1  3
    17 0  1 1  4
    17 0  1 1  5
    17 0  1 1  6
    17 0  1 1  7
    18 0  5 1  1
    18 0  1 1  2
    18 0  1 1  3
    18 0  1 1  4
    end
    Thanks.
    Last edited by Jesus Pulido; 17 Jun 2021, 12:31.
Working...
X