Announcement

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

  • the ever changing regression coefficients in survival analysis

    Dear Statalists,


    I am doing a parametric survival analysis in which regression coefficients change at the 3rd decimal point on wards every time that I rerun the code.

    Following the recommendation on the similar cases initiated at this forum, I have already checked the "sorting" commands so that they uniquely sort the data, as well as, I have used the "stable" option of the sort command. As a result, the problem has been solved in two of the regressions, while it still persists in the third one.

    These regressions show sustainable results in output:

    streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr

    streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==0


    But in this one, the results change by every new run:

    streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==1


    Please note that the only difference between the third and second regressions is in the value that the dummy variable of "litigant" accepts.


    I have no idea that why the code's behavior does not show symmetry toward the different values of the dummy variable.


    I would appreciate any kind advice for the above issue.







  • #2
    You didn't get a quick response. You'll increase your chance of a helpful response by following FAQ #12 - provide Stata code in code delimiters, Stata output, and sample data using dataex.

    While this is very odd, I'm not sure how important variation in the third decimal point is. However, folks cannot replicate your problem so it is hard to diagnose. Does changing the order of running make a difference?

    Comment


    • #3
      Thanks for your help. Changing order of regression does not help unfortunately.

      The supporting information is below:

      ***The Stata version is MP 13.0.

      ***Sample data:

      input float(time0_su time_zero) double(date effect) float earlymem byte(colonial rigorous) float(gatt_mem developed pre_his_cnt) str101 cnt float(id status)
      0 12784 13235 .27 0 0 1 1 0 0 "ARG" 1 1
      451 12784 13426 .27 0 0 1 1 0 1 "ARG" 1 1
      642 12784 13625 .27 0 0 1 1 0 2 "ARG" 1 1
      841 12784 13795 .27 0 0 1 1 0 3 "ARG" 1 1
      1011 12784 13867 .27 0 0 1 1 0 4 "ARG" 1 1
      1083 12784 13877 .27 0 0 1 1 0 5 "ARG" 1 1
      1093 12784 13975 .27 0 0 1 1 0 6 "ARG" 1 1
      1191 12784 13991 .27 0 0 1 1 0 7 "ARG" 1 1
      1207 12784 14145 .27 0 0 1 1 0 8 "ARG" 1 1
      1361 12784 14236 .27 0 0 1 1 0 9 "ARG" 1 1
      1452 12784 14258 .38 0 0 1 1 0 10 "ARG" 1 1
      1474 12784 14304 .38 0 0 1 1 0 11 "ARG" 1 1
      1520 12784 14370 .38 0 0 1 1 0 12 "ARG" 1 1
      1586 12784 14396 .38 0 0 1 1 0 13 "ARG" 1 1
      1612 12784 14635 .38 0 0 1 1 0 14 "ARG" 1 1
      1851 12784 14651 .38 0 0 1 1 0 15 "ARG" 1 1
      1867 12784 14760 .38 0 0 1 1 0 16 "ARG" 1 1
      1976 12784 14888 .38 0 0 1 1 0 17 "ARG" 1 1
      2104 12784 14945 .38 0 0 1 1 0 18 "ARG" 1 1
      2161 12784 14965 .38 0 0 1 1 0 19 "ARG" 1 1
      2181 12784 15025 .06 0 0 1 1 0 20 "ARG" 1 1
      2241 12784 15116 .06 0 0 1 1 0 21 "ARG" 1 1
      2332 12784 15120 .06 0 0 1 1 0 22 "ARG" 1 1
      2336 12784 15232 .06 0 0 1 1 0 23 "ARG" 1 1
      2448 12784 15286 .06 0 0 1 1 0 24 "ARG" 1 1
      2502 12784 15587 .06 0 0 1 1 0 25 "ARG" 1 1
      2803 12784 15610 .06 0 0 1 1 0 26 "ARG" 1 1
      2826 12784 15620 .06 0 0 1 1 0 27 "ARG" 1 1
      2836 12784 15634 .06 0 0 1 1 0 28 "ARG" 1 1
      2850 12784 15651 .06 0 0 1 1 0 29 "ARG" 1 1
      2867 12784 15694 .06 0 0 1 1 0 30 "ARG" 1 1
      2910 12784 15754 -.26 0 0 1 1 0 31 "ARG" 1 1
      2970 12784 15812 -.26 0 0 1 1 0 32 "ARG" 1 1
      3028 12784 15838 -.26 0 0 1 1 0 33 "ARG" 1 1
      3054 12784 15839 -.26 0 0 1 1 0 35 "ARG" 1 1
      3054 12784 15838 -.26 0 0 1 1 0 34 "ARG" 1 1
      3055 12784 15868 -.26 0 0 1 1 0 36 "ARG" 1 1
      3084 12784 16335 0 0 0 1 1 0 37 "ARG" 1 1
      3551 12784 16399 0 0 0 1 1 0 38 "ARG" 1 1
      3615 12784 16555 -.02 0 0 1 1 0 39 "ARG" 1 1
      3771 12784 16607 -.02 0 0 1 1 0 40 "ARG" 1 1
      3823 12784 16742 -.02 0 0 1 1 0 41 "ARG" 1 1
      3958 12784 16890 -.09 0 0 1 1 0 42 "ARG" 1 1
      4106 12784 16890 -.09 0 0 1 1 0 43 "ARG" 1 1
      4106 12784 16904 -.09 0 0 1 1 0 44 "ARG" 1 1
      4120 12784 16972 -.09 0 0 1 1 0 45 "ARG" 1 1
      4188 12784 17050 -.09 0 0 1 1 0 46 "ARG" 1 1
      4266 12784 17099 -.09 0 0 1 1 0 47 "ARG" 1 1
      4315 12784 17161 -.09 0 0 1 1 0 48 "ARG" 1 1
      4377 12784 17163 -.09 0 0 1 1 0 49 "ARG" 1 1
      4379 12784 17174 .01 0 0 1 1 0 50 "ARG" 1 1
      4390 12784 17199 .01 0 0 1 1 0 51 "ARG" 1 1
      4415 12784 17223 .01 0 0 1 1 0 52 "ARG" 1 1
      4439 12784 17266 .01 0 0 1 1 0 53 "ARG" 1 1
      4482 12784 17358 .01 0 0 1 1 0 54 "ARG" 1 1
      4574 12784 17434 .01 0 0 1 1 0 56 "ARG" 1 1
      4650 12784 17434 .01 0 0 1 1 0 55 "ARG" 1 1
      4650 12784 17794 0 0 0 1 1 0 57 "ARG" 1 1
      5010 12784 17829 0 0 0 1 1 0 58 "ARG" 1 1
      5045 12784 17862 0 0 0 1 1 0 59 "ARG" 1 1
      5078 12784 17863 0 0 0 1 1 0 60 "ARG" 1 1
      5079 12784 17867 0 0 0 1 1 0 61 "ARG" 1 1
      5083 12784 17883 0 0 0 1 1 0 62 "ARG" 1 1
      5099 12784 17996 -.13 0 0 1 1 0 63 "ARG" 1 1
      5212 12784 18031 -.13 0 0 1 1 0 64 "ARG" 1 1
      5247 12784 18071 -.13 0 0 1 1 0 65 "ARG" 1 1
      5287 12784 18071 -.13 0 0 1 1 0 66 "ARG" 1 1
      5287 12784 18130 -.13 0 0 1 1 0 67 "ARG" 1 1
      5346 12784 18206 -.13 0 0 1 1 0 68 "ARG" 1 1
      5422 12784 18401 -.32 0 0 1 1 0 69 "ARG" 1 1
      5617 12784 18520 -.32 0 0 1 1 0 70 "ARG" 1 1
      5736 12784 18675 -.18 0 0 1 1 0 71 "ARG" 1 1
      5891 12784 19174 -.18 0 0 1 1 0 71 "ARG" 1 0
      0 12784 12807 1.66 1 0 0 1 1 0 "AUS" 31 1
      23 12784 12922 1.66 1 0 0 1 1 1 "AUS" 31 1
      138 12784 12982 1.66 1 0 0 1 1 2 "AUS" 31 1
      198 12784 12988 1.66 1 0 0 1 1 3 "AUS" 31 1
      204 12784 13061 1.66 1 0 0 1 1 4 "AUS" 31 1
      277 12784 13107 1.66 1 0 0 1 1 5 "AUS" 31 1
      323 12784 13174 1.66 1 0 0 1 1 6 "AUS" 31 1
      390 12784 13235 1.66 1 0 0 1 1 7 "AUS" 31 1
      451 12784 13319 1.66 1 0 0 1 1 8 "AUS" 31 1
      535 12784 13358 1.66 1 0 0 1 1 9 "AUS" 31 1
      574 12784 13429 1.66 1 0 0 1 1 10 "AUS" 31 1
      645 12784 13430 1.66 1 0 0 1 1 11 "AUS" 31 1
      646 12784 13583 1.66 1 0 0 1 1 12 "AUS" 31 1
      799 12784 13711 1.66 1 0 0 1 1 13 "AUS" 31 1
      927 12784 13795 1.66 1 0 0 1 1 14 "AUS" 31 1
      1011 12784 13828 1.66 1 0 0 1 1 15 "AUS" 31 1
      1044 12784 13836 1.66 1 0 0 1 1 16 "AUS" 31 1
      1052 12784 13867 1.66 1 0 0 1 1 17 "AUS" 31 1
      1083 12784 13877 1.66 1 0 0 1 1 18 "AUS" 31 1
      1093 12784 13930 1.66 1 0 0 1 1 19 "AUS" 31 1
      1146 12784 14003 1.66 1 0 0 1 1 20 "AUS" 31 1
      1219 12784 14270 1.6 1 0 0 1 1 21 "AUS" 31 1
      1486 12784 14276 1.6 1 0 0 1 1 22 "AUS" 31 1
      1492 12784 14320 1.6 1 0 0 1 1 23 "AUS" 31 1
      1536 12784 14347 1.6 1 0 0 1 1 24 "AUS" 31 1
      1563 12784 14396 1.6 1 0 0 1 1 25 "AUS" 31 1
      1612 12784 14441 1.6 1 0 0 1 1 26 "AUS" 31 1
      end
      format %td date
      label var effect "government effectiveness: [-2.5,2.5]"
      label var gatt_mem "gatt member=1 & joined after 1996=0 & not member=2"
      label var developed "developed=1 & developing=0"
      label var id "group(cnt)"
      [/CODE]



      ***Stata code:

      Code:
      stset date, fail(status==1) origin (time time_zero) exit(status==0) id(id) enter(time0_su)
      
      sort cnt date, stable
      streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==0
      outreg2 using test960401c.xls, stats(coef pval se) replace ctitle(weibull-def)
      
      streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==1
      outreg2 using test960401c.xls, stats(coef pval se) append ctitle(weibull-comp)
      
      streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr
      outreg2 using test960401c.xls, stats(coef pval se) append ctitle(weibull-main)
      ​​​​​​


      Thank you.

      Comment


      • #4
        Homa:
        -litigant- does not seem to be included in your code.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Homa:
          -litigant- does not seem to be included in your code.

          Carlo you are right. Below please find the required data for replicating code.
          Since my MS.c. thesis deadline is close, I am just in need for this code to be sustainable. I would really appreciate any kind help on the problem.


          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float(time0_su time_zero) double(date effect) float earlymem byte(colonial rigorous) float(gatt_mem developed pre_his_cnt) str101 cnt float(id status litigant)
             0 12784 13235  .27 0 0 1 1 0  0 "ARG"  1 1 1
           451 12784 13426  .27 0 0 1 1 0  1 "ARG"  1 1 0
           642 12784 13625  .27 0 0 1 1 0  2 "ARG"  1 1 0
           841 12784 13795  .27 0 0 1 1 0  3 "ARG"  1 1 1
          1011 12784 13867  .27 0 0 1 1 0  4 "ARG"  1 1 1
          1083 12784 13877  .27 0 0 1 1 0  5 "ARG"  1 1 1
          1093 12784 13975  .38 0 0 1 1 0  6 "ARG"  1 1 0
          1191 12784 13991  .38 0 0 1 1 0  7 "ARG"  1 1 0
          1207 12784 14145  .38 0 0 1 1 0  8 "ARG"  1 1 0
          1361 12784 14236  .38 0 0 1 1 0  9 "ARG"  1 1 0
          1452 12784 14258  .38 0 0 1 1 0 10 "ARG"  1 1 0
          1474 12784 14304  .38 0 0 1 1 0 11 "ARG"  1 1 0
          1520 12784 14370  .38 0 0 1 1 0 12 "ARG"  1 1 0
          1586 12784 14396  .38 0 0 1 1 0 13 "ARG"  1 1 1
          1612 12784 14635  .06 0 0 1 1 0 14 "ARG"  1 1 0
          1851 12784 14651  .06 0 0 1 1 0 15 "ARG"  1 1 0
          1867 12784 14760  .06 0 0 1 1 0 16 "ARG"  1 1 0
          1976 12784 14888  .06 0 0 1 1 0 17 "ARG"  1 1 1
          2104 12784 14945  .06 0 0 1 1 0 18 "ARG"  1 1 1
          2161 12784 14965  .06 0 0 1 1 0 19 "ARG"  1 1 1
          2181 12784 15025  .06 0 0 1 1 0 20 "ARG"  1 1 1
          2241 12784 15116  .06 0 0 1 1 0 21 "ARG"  1 1 1
          2332 12784 15120  .06 0 0 1 1 0 22 "ARG"  1 1 0
          2336 12784 15232  .06 0 0 1 1 0 23 "ARG"  1 1 0
          2448 12784 15286  .06 0 0 1 1 0 24 "ARG"  1 1 0
          2502 12784 15587 -.26 0 0 1 1 0 25 "ARG"  1 1 1
          2803 12784 15610 -.26 0 0 1 1 0 26 "ARG"  1 1 1
          2826 12784 15620 -.26 0 0 1 1 0 27 "ARG"  1 1 1
          2836 12784 15634 -.26 0 0 1 1 0 28 "ARG"  1 1 1
          2850 12784 15651 -.26 0 0 1 1 0 29 "ARG"  1 1 1
          2867 12784 15694 -.26 0 0 1 1 0 30 "ARG"  1 1 1
          2910 12784 15754    0 0 0 1 1 0 31 "ARG"  1 1 1
          2970 12784 15812    0 0 0 1 1 0 32 "ARG"  1 1 1
          3028 12784 15838    0 0 0 1 1 0 34 "ARG"  1 1 1
          3054 12784 15839    0 0 0 1 1 0 35 "ARG"  1 1 1
          3054 12784 15838    0 0 0 1 1 0 33 "ARG"  1 1 1
          3055 12784 15868    0 0 0 1 1 0 36 "ARG"  1 1 1
          3084 12784 16335 -.02 0 0 1 1 0 37 "ARG"  1 1 1
          3551 12784 16399 -.02 0 0 1 1 0 38 "ARG"  1 1 1
          3615 12784 16555 -.09 0 0 1 1 0 39 "ARG"  1 1 0
          3771 12784 16607 -.09 0 0 1 1 0 40 "ARG"  1 1 1
          3823 12784 16742 -.09 0 0 1 1 0 41 "ARG"  1 1 1
          3958 12784 16890  .01 0 0 1 1 0 42 "ARG"  1 1 1
          4106 12784 16904  .01 0 0 1 1 0 44 "ARG"  1 1 1
          4106 12784 16890  .01 0 0 1 1 0 43 "ARG"  1 1 1
          4120 12784 16972  .01 0 0 1 1 0 45 "ARG"  1 1 1
          4188 12784 17050  .01 0 0 1 1 0 46 "ARG"  1 1 1
          4266 12784 17099  .01 0 0 1 1 0 47 "ARG"  1 1 1
          4315 12784 17161  .01 0 0 1 1 0 48 "ARG"  1 1 1
          4377 12784 17163  .01 0 0 1 1 0 49 "ARG"  1 1 1
          4379 12784 17174    0 0 0 1 1 0 50 "ARG"  1 1 1
          4390 12784 17199    0 0 0 1 1 0 51 "ARG"  1 1 1
          4415 12784 17223    0 0 0 1 1 0 52 "ARG"  1 1 1
          4439 12784 17266    0 0 0 1 1 0 53 "ARG"  1 1 1
          4482 12784 17358    0 0 0 1 1 0 54 "ARG"  1 1 1
          4574 12784 17434    0 0 0 1 1 0 56 "ARG"  1 1 1
          4650 12784 17434    0 0 0 1 1 0 55 "ARG"  1 1 1
          4650 12784 17794 -.13 0 0 1 1 0 57 "ARG"  1 1 1
          5010 12784 17829 -.13 0 0 1 1 0 58 "ARG"  1 1 1
          5045 12784 17862 -.13 0 0 1 1 0 59 "ARG"  1 1 1
          5078 12784 17863 -.13 0 0 1 1 0 60 "ARG"  1 1 1
          5079 12784 17867 -.13 0 0 1 1 0 61 "ARG"  1 1 1
          5083 12784 17883 -.13 0 0 1 1 0 62 "ARG"  1 1 1
          5099 12784 17996 -.32 0 0 1 1 0 63 "ARG"  1 1 1
          5212 12784 18031 -.32 0 0 1 1 0 64 "ARG"  1 1 1
          5247 12784 18071 -.32 0 0 1 1 0 66 "ARG"  1 1 1
          5287 12784 18071 -.32 0 0 1 1 0 65 "ARG"  1 1 1
          5287 12784 18130 -.32 0 0 1 1 0 67 "ARG"  1 1 1
          5346 12784 18206 -.32 0 0 1 1 0 68 "ARG"  1 1 1
          5422 12784 18401 -.18 0 0 1 1 0 69 "ARG"  1 1 0
          5617 12784 18520 -.18 0 0 1 1 0 70 "ARG"  1 1 1
          5736 12784 18675 -.14 0 0 1 1 0 71 "ARG"  1 1 1
          5891 12784 19174 -.14 0 0 1 1 0 71 "ARG"  1 0 1
             0 12784 12807 1.66 1 0 0 1 1  0 "AUS" 31 1 1
            23 12784 12922 1.66 1 0 0 1 1  1 "AUS" 31 1 1
           138 12784 12982 1.66 1 0 0 1 1  2 "AUS" 31 1 1
           198 12784 12988 1.66 1 0 0 1 1  3 "AUS" 31 1 1
           204 12784 13061 1.66 1 0 0 1 1  4 "AUS" 31 1 0
           277 12784 13107 1.66 1 0 0 1 1  5 "AUS" 31 1 0
           323 12784 13174 1.66 1 0 0 1 1  6 "AUS" 31 1 1
           390 12784 13235 1.66 1 0 0 1 1  7 "AUS" 31 1 1
           451 12784 13319 1.66 1 0 0 1 1  8 "AUS" 31 1 1
           535 12784 13358 1.66 1 0 0 1 1  9 "AUS" 31 1 1
           574 12784 13429 1.66 1 0 0 1 1 10 "AUS" 31 1 0
           645 12784 13430 1.66 1 0 0 1 1 11 "AUS" 31 1 1
           646 12784 13583 1.66 1 0 0 1 1 12 "AUS" 31 1 1
           799 12784 13711 1.66 1 0 0 1 1 13 "AUS" 31 1 1
           927 12784 13795 1.66 1 0 0 1 1 14 "AUS" 31 1 1
          1011 12784 13828 1.66 1 0 0 1 1 15 "AUS" 31 1 0
          1044 12784 13836 1.66 1 0 0 1 1 16 "AUS" 31 1 1
          1052 12784 13867 1.66 1 0 0 1 1 17 "AUS" 31 1 1
          1083 12784 13877 1.66 1 0 0 1 1 18 "AUS" 31 1 1
          1093 12784 13930  1.6 1 0 0 1 1 19 "AUS" 31 1 0
          1146 12784 14003  1.6 1 0 0 1 1 20 "AUS" 31 1 0
          1219 12784 14270  1.6 1 0 0 1 1 21 "AUS" 31 1 1
          1486 12784 14276  1.6 1 0 0 1 1 22 "AUS" 31 1 1
          1492 12784 14320  1.6 1 0 0 1 1 23 "AUS" 31 1 1
          1536 12784 14347  1.6 1 0 0 1 1 24 "AUS" 31 1 1
          1563 12784 14396  1.6 1 0 0 1 1 25 "AUS" 31 1 1
          1612 12784 14441  1.6 1 0 0 1 1 26 "AUS" 31 1 1
          end
          format %td date
          Code:
          stset date, fail(status==1) origin (time time_zero) exit(status==0) id(id) enter(time0_su)  sort cnt date, stable
          
          streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr
          outreg2 using test960403b.xls, stats(coef pval se) append ctitle(weibull-main)
          
          streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==1
          outreg2 using test960403b.xls, stats(coef pval se) append ctitle(weibull-comp)
          
          streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==0
          outreg2 using test960403b.xls, stats(coef pval se) append ctitle(weibull-resp)
          Last edited by Homa Taheri; 24 Jun 2017, 22:49.

          Comment


          • #6
            I am not a user of streg so I don't feel qualified to attempt your commands on your sample data. However, I see that help streg tells us
            Code:
            Syntax
            
                    streg [varlist] [if] [in] [, options]
            So, like most Stata commands, the if clause should come before, not after, the options, and does not have a comma preceding it. This suggests that you try replacing the two commands
            Code:
            streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==1
            
            streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==0
            with
            Code:
            streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect if litigant==1, dist(weibull) vce(cluster id) nohr
            
            streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect if litigant==0, dist(weibull) vce(cluster id) nohr
            and see if using the recommended syntax resolves this problem.

            Comment


            • #7
              Originally posted by William Lisowski View Post
              I am not a user of streg so I don't feel qualified to attempt your commands on your sample data. However, I see that help streg tells us
              Code:
              Syntax
              
              streg [varlist] [if] [in] [, options]
              So, like most Stata commands, the if clause should come before, not after, the options, and does not have a comma preceding it. This suggests that you try replacing the two commands
              Code:
              streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==1
              
              streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect, dist(weibull) vce(cluster id) nohr, if litigant==0
              with
              Code:
              streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect if litigant==1, dist(weibull) vce(cluster id) nohr
              
              streg pre_his_cnt c.pre_his_cnt#c.pre_his_cnt developed gatt_mem rigorous colonial earlymem effect if litigant==0, dist(weibull) vce(cluster id) nohr
              and see if using the recommended syntax resolves this problem.
              Thanks William, but it did not work.

              Comment


              • #8
                Can you show us the exact stset command you used?

                Comment


                • #9
                  Originally posted by Oded Mcdossi View Post
                  Can you show us the exact stset command you used?
                  Of course, please find it below: stset date, fail(status==1) origin (time time_zero) exit(status==0) id(id) enter(time0_su) sort cnt date, stable

                  Comment


                  • #10
                    According to the help file of stset
                    if(exp) select records for which exp is true; recommended rather than if exp
                    which means when you want to analyse subset of your data you should first stset, clear and then stset again with the if expression under the stset command and not under the streg command. Hope this helps.

                    Comment


                    • #11
                      Originally posted by Oded Mcdossi View Post
                      According to the help file of stset which means when you want to analyse subset of your data you should first stset, clear and then stset again with the if expression under the stset command and not under the streg command. Hope this helps.
                      Thank you, but the result does not change by this modification.

                      Fortunately, I could finally solve the problem.
                      The solution was to define a counter variable just after the fist time that I sorted data in this way:
                      Code:
                      sort cnt date, stable
                      by cnt: gen obs=_n
                      sort cnt date obs, stable
                      Then I added the "obs" as the last item in all the "sorting" code lines.
                      As a result, now have a stable code.


                      Thanks for all recommendations. I learned a lot.








                      Comment


                      • #12
                        There is more to learn.

                        In none of the code you showed did you reveal that you were sorting repeatedly. In post #5 you removed the one sort you showed (I now see) in post #2. You chose to show us the code you thought mattered rather than the code you actually ran.

                        Repeated sorting is an obvious cause of inconsistent results like yours and would have surfaced immediately had you shown the code you ran.

                        The advice in the FAQ is very clear on accurately showing what you ran. Please keep this in mind for your future posts.

                        Comment


                        • #13
                          Originally posted by William Lisowski View Post
                          There is more to learn.

                          In none of the code you showed did you reveal that you were sorting repeatedly. In post #5 you removed the one sort you showed (I now see) in post #2. You chose to show us the code you thought mattered rather than the code you actually ran.

                          Repeated sorting is an obvious cause of inconsistent results like yours and would have surfaced immediately had you shown the code you ran.

                          The advice in the FAQ is very clear on accurately showing what you ran. Please keep this in mind for your future posts.
                          You are right, but, I had no criterion for choosing parts of my 500 line code, other than what it seemed to be relevant to the problem. May I have your kind advice for choosing the most related parts of the code for the next times?

                          Comment


                          • #14
                            To assert that regression results change from run to run requires confirming that the input to the commands is the same from run to run; otherwise the performance of the regression is irrelevant. If instead it is known that the input is changing from run to run, the regression commands are irrelevant.

                            This suggests simplifying code, running data preparation separately one time saving the results, then reusing the saved file before each regression. In this case, doing so would have reduced the size of the 500-line code, and likely would reveal that the regressions produce the same results when run on the same data. This would have pointed to the problem being in the data preparation step and eventually discovering that, apparently, the sorting commands did not uniquely sort the data.

                            Comment

                            Working...
                            X