Announcement

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

  • Survival analysis

    Hi everyone I'm dealing with survial analysis. In my stset command, I introduce pweight variable. If I run the sts list by (group), I obtain negative values in the Fail column in latest time. Is it normal? Can any one give explanation. Thanks a lot

  • #2
    I think the information you have provided is too scanty for anyone to respond. Please post back showing the following:
    1. The complete, exact -stset- and -sts list- commands you used.
    2. The complete, exact output that Stata gave in response to those.
    3. Example data that reproduces the problem you are encountering. Use the -dataex- command to do this. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.
    Then it may be possible to troubleshoot.

    Comment


    • #3
      Hello Clyde
      Thank you much for replying. I'm analysing the effect of age (AGESORTIEBON) of school-leavers on their duration(BDurePEMPF) to access to a first job (PEMPF).
      The data example is as followed:

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input double(newid pond) float(PEMPF BDurePEMPF AGESORTIEBON)
      1 2.0968 1 1.00e-07 1
      2  1.303 0 1.00e-07 2
      2  1.303 0       51 2
      3  1.303 0 1.00e-07 1
      3  1.303 0        9 1
      3  1.303 1       58 1
      4 1.2267 0 1.00e-07 1
      4 1.2267 0        7 1
      4 1.2267 0       14 1
      4 1.2267 0       36 1
      end
      label values AGESORTIEBON AGESORTIEBON
      label def AGESORTIEBON 1 "moins de 24ans", modify
      label def AGESORTIEBON 2 "25 à 45 ans", modify
      label var AGESORTIEBON "RECODE of AGESORTIE (RECODE of AgeSortie)"
      My Stset command:
      "stset BDurePEMPF [pweight = pond], id(newid) failure(PEMPF==1) scale(1)" and exact results:

      id: newid
      failure event: PEMPF == 1
      obs. time interval: (BDurePEMPF[_n-1], BDurePEMPF]
      exit on or before: failure
      weight: [pweight=pond]

      ------------------------------------------------------------------------------
      4,047 total observations
      1,682 observations begin on or after (first) failure
      ------------------------------------------------------------------------------
      2,365 observations remaining, representing
      1,106 subjects
      981 failures in single-failure-per-subject data
      15,510 total analysis time at risk and under observation
      at risk from t = 0
      earliest observed entry t = 0
      last observed exit t = 73


      My sts list by age-group command: " sts list, f at(0 1 to 60) by(AGESORTIEBON)" and result:

      failure _d: PEMPF == 1
      analysis time _t: BDurePEMPF
      id: newid
      weight: [pweight=pond]

      Beg. Failure
      Time Total Fail Function
      ------------------------------------------------
      moins de 24ans
      0 0 0 0.0000
      1 661.254 514.952 0.4289
      2 641.839 21.8534 0.4484
      3 618.604 15.8146 0.4625
      4 601.123 17.9559 0.4785
      5 583.167 12.2085 0.4895
      6 567.984 12.1257 0.5004
      7 554.176 9.7147 0.5091
      8 544.461 14.7907 0.5225
      9 528.444 5.8362 0.5277
      10 521.29 11.8408 0.5385
      11 509.449 15.9759 0.5529
      12 493.473 25.6866 0.5762
      13 463.18 12.3307 0.5875
      14 450.849 5.573 0.5926
      15 443.094 8.0867 0.6000
      16 433.469 4.9618 0.6046
      17 428.507 14.723 0.6182
      18 413.784 4.3557 0.6222
      19 409.429 10.0398 0.6315
      20 397.242 9.7355 0.6405
      21 387.506 13.4606 0.6530
      22 372.335 6.1353 0.6587
      23 364.533 11.2503 0.6692
      24 350.009 20.6782 0.6888
      25 327.621 10.7401 0.6990
      26 316.88 5.98 0.7047
      27 310.9 7.2058 0.7115
      28 303.695 9.8878 0.7209
      29 293.807 14.3111 0.7345
      30 279.496 9.1963 0.7432
      31 268.633 5.746 0.7487
      32 261.584 5.0909 0.7536
      33 256.493 8.3884 0.7617
      34 243.535 8.7068 0.7702
      35 234.829 10.3991 0.7804
      36 219.521 9.2048 0.7896
      37 208.649 4.9914 0.7946
      38 203.658 4.6979 0.7993
      39 197.198 8.1255 0.8076
      40 187.406 2.6077 0.8103
      41 183.235 4.6921 0.8152
      42 175.307 4.6973 0.8201
      43 169.306 2.7902 0.8231
      44 166.516 12.0209 0.8358
      45 150.913 4.6432 0.8409
      46 146.27 2.9027 0.8440
      47 141.993 2.0909 0.8463
      48 139.902 9.3428 0.8566
      49 124.308 6.811 0.8645
      50 113.965 1.7105 0.8665
      51 109.197 10.6788 0.8796
      52 90.1379 4.0169 0.8849
      53 82.7538 6.1561 0.8935
      54 70.8769 4.5744 0.9004
      55 62.3487 11.5107 0.9188
      56 48.154 5.7038 0.9284
      57 37.1428 2.3e-13 0.9284
      58 37.1428 1.303 0.9309
      59 34.158 1.8462 0.9346
      60 32.3118 1.3182 0.9373
      25 à 45 ans
      0 0 0 0.0000
      1 275.295 273.462 0.5028
      2 265.81 13.7463 0.5285
      3 252.064 21.1565 0.5681
      4 230.907 8.6782 0.5843
      5 222.229 9.6534 0.6024
      6 212.576 4.4607 0.6107
      7 206.888 7.3348 0.6245
      8 199.553 11.2903 0.6458
      9 188.263 4.2595 0.6538
      10 184.004 3.1498 0.6597
      11 180.854 3.3573 0.6660
      12 177.496 4.4248 0.6743
      13 173.072 7.9504 0.6893
      14 164.121 4.7106 0.6982
      15 157.999 6.2737 0.7102
      16 151.725 7.0038 0.7236
      17 144.721 2.9744 0.7293
      18 141.747 1.5217 0.7322
      19 140.225 2.8399 0.7376
      20 136.067 1.2267 0.7400
      21 134.84 2.9063 0.7456
      22 131.934 3.2234 0.7518
      23 128.711 5.9712 0.7633
      24 122.74 9.0712 0.7808
      25 113.668 5.0773 0.7906
      26 108.591 2.8795 0.7961
      27 105.712 4.6241 0.8051
      28 101.087 1.88 0.8087
      29 99.2075 3.0328 0.8145
      30 96.1747 1.4375 0.8173
      31 96.1747 0 0.8173
      32 94.7372 1.5111 0.8202
      33 93.2261 3.0729 0.8261
      34 90.1532 2.4085 0.8308
      35 87.7447 4.984 0.8404
      36 81.4577 4.5651 0.8493
      37 75.1307 1.5111 0.8524
      38 73.6196 8.0246 0.8685
      39 65.595 4.4178 0.8773
      40 61.1772 1.6667 0.8807
      41 57.6643 1.6 0.8840
      42 53.2502 3.8284 0.8923
      43 49.4218 1.625 0.8959
      44 47.7968 2.7484 0.9018
      45 47.7968 0 0.9018
      46 47.7968 0 0.9018
      47 45.0484 0 0.9018
      48 43.3484 1.4375 0.9051
      49 41.9109 5.0995 0.9166
      50 36.8114 5.2818 0.9286
      51 31.5296 1.3478 0.9317
      52 27.4788 -5.7e-14 0.9317
      53 23.0657 1.5111 0.9361
      54 23.0657 -5.7e-14 0.9361
      55 19.8879 -5.7e-14 0.9361
      56 18.4007 2.9623 0.9464
      57 15.4384 1.7123 0.9524
      58 13.7261 3.6924 0.9652
      59 13.7261 5.7e-14 0.9652
      60 13.7261 5.7e-14 0.9652
      ------------------------------------------------
      Note: Failure function is calculated over full
      data and evaluated at indicated times; it
      is not calculated from aggregates shown at
      left.



      Comment


      • #4
        Looking at the commands, I see nothing wrong here.

        In the output, there are indeed a few lines that have negative numbers in the fail column. But these negative numbers are extremely small, and I'm confident they represent rounding errors, the real number of failures being 0. I think this kind of rounding arises because you have non-integer numbers of failures, as a result of the pweights, and at a certain point this just happens. I doubt there is anything you can do about it. I wouldn't really worry about it. The most important part of the output is the failure function in the last column, and it looks quite normal.

        Comment


        • #5
          Dear Clyde

          Thank you very much for this encouraging response. It will allow me to go ahead.

          With very best regards

          Comment


          • #6
            Hello Dear Clyde
            I hope you're doing well. Let me thank you again for your previous help with my data. I'am back with analysis issues now.
            I run cox regression where one variable (SEXE1) interact twice with 2 others. How do I interpret the 1.SEXE1 Hazard Ratio (HR)? I know that if SEXE1 was in interaction with only one variable, I should interpret 1.SEXE1 HR as the effect of sex for the reference category of the other variable? Is it ok if I interpret my case as the effect of sex for the reference categories of the 2 variables (Parent_SAL and FILIERESEC2).
            Please have a look in my command:

            stcox AGECOX2 COHORT1 Niveau_DiplomeCOX2 Niveau_DiplomeCOX3 STATUECOLCOX1 NIVPERECOX2 NIVPERECOX3 NIVMERECOX2 NIVMERECOX3 TRAVETUDECOX1 TParcours4ACOX1 VIECO_ECOLCOX1 INTENTIONBONCOX2 INTENTIONBONCOX3 VIECOM_PROC2COX2 MobilResidCOX2 MobilResidCOX3 SEXE1##Parent_SAL SEXE1##FILIERESEC2, tvc(RELATIONCOX2 STAGECOX2 BDureCHOM BDureAFSSV) texp(_t>12)

            with part of results

            (Std. Err. adjusted for 618 clusters in newid)

            Robust
            _t Haz. Ratio Std. Err. z P>z [95% Conf. Interval]

            main
            AGECOX2 1.191452 .213162 0.98 0.328 .8390514 1.691861
            COHORT1 .9213449 .1183526 -0.64 0.524 .7162753 1.185126
            Niveau_DiplomeCOX2 .4079927 .0691601 -5.29 0.000 .2926594 .5687774
            Niveau_DiplomeCOX3 .6227901 .1164696 -2.53 0.011 .4316744 .8985185
            STATUECOLCOX1 .9675226 .1624553 -0.20 0.844 .696205 1.344575
            NIVPERECOX2 .9625857 .1504265 -0.24 0.807 .7086295 1.307554
            NIVPERECOX3 .8429818 .1786922 -0.81 0.420 .5563955 1.277182
            NIVMERECOX2 1.066104 .1850291 0.37 0.712 .7586966 1.498066
            NIVMERECOX3 1.271166 .300705 1.01 0.310 .7995456 2.020976
            TRAVETUDECOX1 1.122697 .2308717 0.56 0.574 .7502759 1.679979
            TParcours4ACOX1 1.036442 .2020377 0.18 0.854 .7073219 1.518704
            VIECO_ECOLCOX1 .5235972 .1701031 -1.99 0.046 .27699 .9897614
            INTENTIONBONCOX2 .9715032 .1470767 -0.19 0.849 .7220712 1.307099
            INTENTIONBONCOX3 .9342495 .2256326 -0.28 0.778 .5819522 1.499817
            VIECOM_PROC2COX2 .9608092 .2371753 -0.16 0.871 .5922682 1.558676
            MobilResidCOX2 .8136275 .1362535 -1.23 0.218 .585976 1.129722
            MobilResidCOX3 1.055082 .1754078 0.32 0.747 .7616819 1.4615
            1.SEXE1 1.360155 .2259295 1.85 0.064 .9821976 1.883553
            1.Parent_SAL 1.157758 .2454496 0.69 0.490 .7641164 1.754188

            SEXE1#Parent_SAL
            1 1 .8220984 .2337737 -0.69 0.491 .470841 1.435401

            1.FILIERESEC2 1.523504 .4927045 1.30 0.193 .8082827 2.871601

            SEXE1#FILIERESEC2
            1 1 .984292 .4231782 -0.04 0.971 .4238044 2.286032

            tvc
            RELATIONCOX2 .8719985 .2710091 -0.44 0.659 .4742093 1.603472
            STAGECOX2 .3038146 .3379903 -1.07 0.284 .0343286 2.688814
            BDureCHOM 1.011204 .0043098 2.61 0.009 1.002792 1.019686
            BDureAFSSV 1.008822 .0042843 2.07 0.039 1.000459 1.017254

            Note: Variables in tvc equation interacted with _t>12.

            Thanks a lot

            Comment


            • #7
              Yes, the hazard ratio for the SEXE variable is the effect of SEXE conditional on both Parent_SAL and FILIERESEC2 being zero.

              I do not recommend interpreting interactions by hand, except in the simplest cases. Use -margins- instead: it will keep you from making mistakes, not to mention saving you a lot of time.

              Comment


              • #8
                Thank you too much Dear Clyde. This is helpful for me

                Comment

                Working...
                X