Announcement

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

  • Subjects stcox

    Dear all,

    I need to know the sample which was included in the stcox regression - because I want to use this sample for my tables.
    In the result I read no. of subjects is 165, included in analysis were 190.
    I tried -ereturn list- -stvary, but cannot find it.
    My question: how do I identify the regressed sample?

    Thank you in advance. Cheers, Roberto

  • #2
    Hello Roberto,

    Welcome to the Stata Forum,

    Please present command and output under CODE delimiters or install the SSC dataex, as recommend in the FAQ.

    That said, with missing data, the sample for the regression will be lower. This is the e(sample).
    Best regards,

    Marcos

    Comment


    • #3
      Roberto:
      welcome to the list.
      For the future, please act on FAQ, as reminded by Marcos' wise advice.
      That said, after -stcox- you can type:
      Code:
      g whoisin=e(sample)
      list patientid whoisin
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Dear Carlo and Marcos,

        Thank you for your quick reply. My apologies for not using dataex and/or .

        Code:
        g whoisin=e(sample)
        and then
        Code:
        count if whoisin==1 & nvals==1
        shows 19 subject, whereas the
        Code:
        stcox
        shows 20.
        How can this be different?
        Cheers Roberto, and thank you in advance

        Please find my dataex:
        ----------------------- copy starting from the next line -----------------------
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input int id byte tp float qdatet byte dsmt int enterstudy byte gno float(dead nvals) byte(_st _d) double(_t _t0)
         1 0 11729 13 11729 1 0 0 0 .                  .                  .
         1 1 12184  0 11729 1 0 0 1 0 1.2457562150914467                  0
         1 2 12273  0 11729 1 1 1 1 1 1.4894316066148285 1.2457562150914467
         2 0 11729 13 11729 1 0 0 0 .                  .                  .
         2 1 12184 13 11729 1 0 0 1 0 1.2457562150914467                  0
         2 2 12520 13 11729 1 0 0 1 0 2.1656992662358996 1.2457562150914467
         2 3 13248 13 11729 1 0 0 1 0  4.158909210382214 2.1656992662358996
         2 4 13425 13 11729 1 1 1 1 1  4.643522067681524  4.158909210382214
         4 0 11729 13 11729 1 0 0 0 .                  .                  .
         4 1 12186 13 11729 1 0 0 1 0  1.251232066586354                  0
         4 2 12491  8 11729 1 1 1 1 1 2.0862994195597415  1.251232066586354
         6 0 11729 11 11729 1 0 0 0 .                  .                  .
         6 1 12184 11 11729 1 0 0 1 0 1.2457562150914467                  0
         6 2 12617 11 11729 1 1 1 1 1 2.4312780637389113 1.2457562150914467
         8 0 11729  0 11729 1 0 0 0 .                  .                  .
         8 1 12184  2 11729 1 0 0 1 0 1.2457562150914467                  0
         8 2 12234  2 11729 1 1 1 1 1 1.3826525024641332 1.2457562150914467
        12 0 11729  8 11729 1 0 0 0 .                  .                  .
        12 1 12186  8 11729 1 0 0 1 0  1.251232066586354                  0
        12 2 12222  8 11729 1 1 1 1 1 1.3497973934946883  1.251232066586354
        13 0 11729  8 11729 2 0 0 0 .                  .                  .
        13 1 12186  8 11729 2 0 0 1 0  1.251232066586354                  0
        13 2 12520  8 11729 2 0 0 1 0 2.1656992662358996  1.251232066586354
        13 3 13247  8 11729 2 0 0 1 0  4.156171284634761 2.1656992662358996
        13 4 13710  8 11729 2 0 0 1 0  5.423830905705837  4.156171284634761
        13 5 14173  8 11729 2 0 0 1 0  6.691490526776914  5.423830905705837
        13 6 15050 15 11729 2 0 0 1 0  9.092651407293834  6.691490526776914
        13 7 17984 15 11729 2 1 1 1 1 17.125725550323075  9.092651407293834
        17 0 11729  0 11729 1 0 0 0 .                  .                  .
        17 1 12212  0 11729 1 1 1 1 1  1.322418136020151                  0
        18 0 11729  0 11729 1 0 0 0 .                  .                  .
        18 1 12184  6 11729 1 0 0 1 0 1.2457562150914467                  0
        18 2 12526 10 11729 1 0 0 1 0  2.182126820720622 1.2457562150914467
        18 3 13255 11 11729 1 0 0 1 0   4.17807469061439  2.182126820720622
        18 4 13571 15 11729 1 0 0 1 0  5.043259226809769   4.17807469061439
        18 5 14171 16 11729 1 0 0 1 0  6.686014675282006  5.043259226809769
        18 6 14436 16 11729 1 1 1 1 1  7.411564998357244  6.686014675282006
        19 0 11729 10 11729 1 0 0 0 .                  .                  .
        19 1 12186  8 11729 1 0 0 1 0  1.251232066586354                  0
        19 2 12520 12 11729 1 0 0 1 0 2.1656992662358996  1.251232066586354
        19 3 13247 12 11729 1 0 0 1 0  4.156171284634761 2.1656992662358996
        19 4 13577 11 11729 1 0 0 1 0 5.0596867812944915  4.156171284634761
        19 5 14173 15 11729 1 0 0 1 0  6.691490526776914 5.0596867812944915
        19 6 15154 12 11729 1 0 0 1 0  9.377395685029022  6.691490526776914
        19 7 15564 12 11729 1 1 1 1 1 10.499945241485051  9.377395685029022
        20 0 11617  4 11617 1 0 0 0 .                  .                  .
        20 1 11811  4 11617 1 1 1 1 1  .5311575950060234                  0
        21 0 11729  4 11729 2 0 0 0 .                  .                  .
        21 1 12184  7 11729 2 0 0 1 0 1.2457562150914467                  0
        21 2 12520  6 11729 2 0 0 1 0 2.1656992662358996 1.2457562150914467
        21 3 13255 10 11729 2 0 0 1 0   4.17807469061439 2.1656992662358996
        21 4 13571  8 11729 2 0 0 1 0  5.043259226809769   4.17807469061439
        21 5 14171  4 11729 2 0 0 1 0  6.686014675282006  5.043259226809769
        21 6 15048 11 11729 2 0 0 1 0  9.087175555798927  6.686014675282006
        21 7 18192  9 11729 2 0 0 1 0  17.69521410579345  9.087175555798927
        21 8 18852  9 11729 2 1 1 1 1 19.502245099112912  17.69521410579345
        23 0 11729 10 11729 1 0 0 0 .                  .                  .
        23 1 12325 14 11729 1 0 0 1 0 1.6318037454824226                  0
        23 2 12709 12 11729 1 0 0 1 0 2.6831672325046543 1.6318037454824226
        23 3 13254 13 11729 1 0 0 1 0  4.175336764866937 2.6831672325046543
        23 4 13570 13 11729 1 0 0 1 0  5.040521301062315  4.175336764866937
        23 5 14310  . 11729 1 0 0 1 0 7.0665863541780745  5.040521301062315
        23 6 15050 14 11729 1 0 0 1 0  9.092651407293834 7.0665863541780745
        23 7 18006 14 11729 1 1 1 1 1 17.185959916767057  9.092651407293834
        24 0 11729 14 11729 1 0 0 0 .                  .                  .
        24 1 12184  3 11729 1 0 0 1 0 1.2457562150914467                  0
        24 2 12768  3 11729 1 1 1 1 1 2.8447048516044244 1.2457562150914467
        25 0 11729 16 11729 1 0 0 0 .                  .                  .
        25 1 12186 17 11729 1 0 0 1 0  1.251232066586354                  0
        25 2 12520 21 11729 1 0 0 1 0 2.1656992662358996  1.251232066586354
        25 3 13248 15 11729 1 0 0 1 0  4.158909210382214 2.1656992662358996
        25 4 13577 17 11729 1 0 1 1 0 5.0596867812944915  4.158909210382214
        26 0 11729 10 11729 2 0 0 0 .                  .                  .
        26 1 12184  9 11729 2 0 0 1 0 1.2457562150914467                  0
        26 2 12193  9 11729 2 1 1 1 1 1.2703975468185302 1.2457562150914467
        27 0 11743 15 11743 1 0 0 0 .                  .                  .
        27 1 12274 15 11743 1 0 0 1 0   1.45383857189793                  0
        27 2 12533 13 11743 1 0 0 1 0  2.162961340488446   1.45383857189793
        27 3 13255 16 11743 1 0 0 1 0  4.139743730150038  2.162961340488446
        27 4 13576 13 11743 1 0 0 1 0  5.018617895082685  4.139743730150038
        27 5 14172 13 11743 1 0 0 1 0  6.650421640565107  5.018617895082685
        27 6 15032 12 11743 1 0 1 1 0  9.005037783375315  6.650421640565107
        29 0 11743  5 11743 1 0 0 0 .                  .                  .
        29 1 12198  0 11743 1 0 0 1 0 1.2457562150914467                  0
        29 2 12533  8 11743 1 0 0 1 0  2.162961340488446 1.2457562150914467
        29 3 13255  7 11743 1 0 0 1 0  4.139743730150038  2.162961340488446
        29 4 13576 11 11743 1 0 0 1 0  5.018617895082685  4.139743730150038
        29 5 14172  0 11743 1 0 0 1 0  6.650421640565107  5.018617895082685
        29 6 15032  4 11743 1 0 0 1 0  9.005037783375315  6.650421640565107
        29 7 18192  6 11743 1 0 1 1 0 17.656883145329097  9.005037783375315
        31 0 11743  0 11743 1 0 0 0 .                  .                  .
        31 1 12200  0 11743 1 0 0 1 0  1.251232066586354                  0
        31 2 12533  0 11743 1 0 0 1 0  2.162961340488446  1.251232066586354
        31 3 13254  9 11743 1 0 0 1 0  4.137005804402585  2.162961340488446
        31 4 13311  9 11743 1 1 1 1 1  4.293067572007447  4.137005804402585
        33 0 11743 11 11743 1 0 0 0 .                  .                  .
        33 1 12191 11 11743 1 0 0 1 0 1.2265907348592706                  0
        33 2 12702 15 11743 1 0 0 1 0  2.625670791808126 1.2265907348592706
        33 3 13248 17 11743 1 0 0 1 0 4.1205782499178625  2.625670791808126
        33 4 13711  . 11743 1 0 0 1 0  5.388237870988939 4.1205782499178625
        end
        format %d qdatet
        format %td enterstudy
        ------------------ copy up to and including the previous line ------------------

        Listed 100 out of 100 observations

        Comment


        • #5
          Roberto:
          I cannot see your -stcox- code, so what follows is basically guess-work.
          It may well be that:
          Code:
          ...& nvals==1
          reduces the number of oservations from 20 to 19.
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            Dear Carlo,

            Yes, indeed.
            When I tried
            Code:
            distinct id if whoisin==1
            I received 20 instead of 19. So, mystery is solved.

            Sorry for not mentioning my
            Code:
            stcox
            : it was
            Code:
            stcox dsmt gno
            .

            Best regards,
            Roberto

            Comment

            Working...
            X