Announcement

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

  • Odds of diagnosis question

    Hello!

    I have a dataset that includes information about disease diagnosis based on genders. This diagnosis group has three different diseases in it (Glioma, Meningio, Other) and Gender has (Female, Male). I am trying to calculate the odds for say, meningioma diagnosis compared to any other diagnoses in men, and the same in woman, then finish off with a male vs female of said odds. However, I am lost in how to do that; all I could do was sort by diagnosis and that just tidied up my list. I have no idea how to extract one disease from the group and do the odds for said disease.

    Anyone can lead me to the right direction? Thanks.


  • #2
    Something like this:
    Code:
    gen byte is_meningioma = (diagnosis == "Meningio") if !missing(diagnosis)
    cs is_meningioma sex, or
    You did not show example data, so the above code is written for an imaginary data set that might or might not resemble yours in the relevant ways. If it doesn't, then the code won't work and we will both have wasted our time. In the future, always show example data when asking for code help, and always use the -dataex- command to do that. 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.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment


    • #3
      Hello Cylde,

      Thank you so much for your answer, and sorry that I did not add the dataset. First post/rookie problems, do forgive me. I've just attached my dataset.

      Sorry to waste your time earlier, and thank you so much for future help.
      Attached Files

      Comment


      • #4
        Please re-read what I wrote in #2. You should use the -dataex- command to show example data. Attachments of any kind are discouraged, except for situations where there really is no alternative. I am one of many here who will not download attachments from people I don't know. Please post back using -dataex- and perhaps we can make progress from there.

        To avoid more difficulties using this Forum, and to learn how to get the most out of it, I recommend you read the Forum FAQ. Click on the FAQ button just under the Statalist banner.

        Comment


        • #5
          Hello again Clyde. Thank you for your patience with me. I have gone through the FAQ and here is my dataset with dataex. I wanted to provide more than 20 lines as I have different question now. Hopefully that is ok.

          I have figured the problem from before out. Now, I am trying to run a logrank test to compare survival curves between diagnosis groups. I use sts test diagnosis, logrank command. This works and I get what I want. However, I would like to include two more where I only compare Meningioma and Glioma groups in one and on another compare Glioma and Other. Yet I do not know how to "exclude" a group out of the three.

          Thank you for your answers again and I hope this time I have posted in the right format. Thank you for the instructions.

          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input long(sex diagnosis loc ki) double gtv long(stereo status) double time float(cuberoot_gtv r) byte(_st _d) double _t byte _t0 float(group Meningioma)
          1 2 1  90  6.11 1 0 57.64  1.828158       .5866479 1 0 57.64 0 . 2
          2 1 2  90 19.35 2 1  8.98  2.684687      1.0374488 1 1  8.98 0 1 .
          1 2 1  70  7.95 1 0 26.46 1.9958246       .4089974 1 0 26.46 0 . 2
          1 1 2  80  7.61 2 1  47.8  1.966957       .1607562 1 1  47.8 0 1 .
          2 1 2  90  5.06 2 1   6.3 1.7167886     .069550544 1 1   6.3 0 1 .
          1 2 2  80  4.82 1 0 52.75  1.689205      .21011947 1 0 52.75 0 . 2
          2 2 2  80  3.19 2 0  55.8  1.472076      -.6016083 1 0  55.8 0 . 2
          2 1 2  80 12.37 2 0  42.1  2.312721       .4279075 1 0  42.1 0 1 .
          1 2 2  70 12.16 2 0 34.66 2.2995589       .1967455 1 0 34.66 0 . 2
          2 1 2 100  2.53 2 0 11.48  1.362616     -.50923836 1 0 11.48 0 1 .
          2 1 2  80   .14 2 1 35.93 .51924944      -1.365564 1 1 35.93 0 1 .
          1 2 1  90  6.54 1 0 34.26  1.870076       .6285658 1 0 34.26 0 . 2
          1 2 1  90   .63 1 0 32.98  .8572619      -.3842482 1 0 32.98 0 . 2
          2 3 2  90  6.38 2 0 50.85 1.8546995      .09461594 1 0 50.85 0 . .
          1 2 2  60  9.18 2 0 41.44 2.0938597       -.336805 1 0 41.44 0 . 2
          1 1 2  70 11.38 1 1  7.05 2.2493002       .8513439 1 1  7.05 0 1 .
          1 3 1  60    24 2 1  6.82  2.884499       .5298597 1 1  6.82 0 . .
          2 1 2  90  10.8 2 0 82.56  2.210419      .56318086 1 0 82.56 0 1 .
          2 2 2  80 13.49 1 1  6.92 2.3805134       .8228154 1 1  6.92 0 . 2
          1 2 2  90   2.5 2 0 30.16  1.357209     -.40028745 1 0 30.16 0 . 2
          1 2 2  80  2.82 1 0 24.39 1.4128077     -.06627775 1 0 24.39 0 . 2
          2 1 2  70 14.44 2 1    14  2.435131       .4425761 1 1    14 0 1 .
          1 3 1  80  2.11 1 0 10.49 1.2826086      -.1204515 1 0 10.49 0 . .
          1 2 1 100  2.13 1 1 51.02 1.2866484       -.179478 1 1 51.02 0 . 2
          1 2 2  70  6.48 2 1 33.41 1.8643395      -.2384739 1 1 33.41 0 . 2
          2 1 2  90  4.23 2 1 25.02  1.617261    -.029977053 1 1 25.02 0 1 .
          2 3 2  60 34.64 2 1 11.57 3.2598126       .8265607 1 1 11.57 0 . .
          2 1 2  70 33.69 2 1   .07  3.229736      1.2371807 1 1   .07 0 1 .
          2 2 2  60  3.81 2 0  36.1 1.5618584      -.9474189 1 0  36.1 0 . 2
          1 2 2  90  4.72 1 0 65.02 1.6774414       .4359313 1 0 65.02 0 . 2
          1 1 2  80   .85 1 1   6.1  .9472682      -.3429464 1 1   6.1 0 1 .
          2 2 2  90  2.56 1 0 44.39 1.3679807      .04785807 1 0 44.39 0 . 2
          1 3 1  70 13.45 2 1 10.82 2.3781583       .3513703 1 1 10.82 0 . .
          2 3 1  80  6.81 1 0 57.11 1.8954647      .41379195 1 0 57.11 0 . .
          1 2 2  90   7.3 2 0  5.51 1.9398774       .1823811 1 0  5.51 0 . 2
          1 3 2  70 14.26 2 0  7.18  2.424971       .3981828 1 0  7.18 0 . .
          1 2 2  80   6.6 2 0 14.75 1.8757775      -.1192942 1 0 14.75 0 . 2
          2 1 2  90  9.95 2 1  6.23  2.150838       .5035998 1 1  6.23 0 1 .
          2 3 1  80 12.51 2 1  29.7  2.321413       .3237541 1 1  29.7 0 . .
          1 2 2  90  2.54 2 0 45.74  1.364409      -.3930873 1 0 45.74 0 . 2
          1 2 2  80  1.57 2 0  2.03 1.1622509      -.8328208 1 0  2.03 0 . 2
          2 1 2  90   .28 2 1 16.43  .6542132      -.9930248 1 1 16.43 0 1 .
          1 2 2  70   6.7 2 0 14.56 1.8852036      -.2176098 1 0 14.56 0 . 2
          2 2 2  80 12.63 2 1  4.16 2.3288121      .25512788 1 1  4.16 0 . 2
          2 3 1  90  3.12 2 0 18.95 1.4612287      -.2988548 1 0 18.95 0 . .
          2 2 2  60  7.09 1 1 31.25 1.9210945    -.072196506 1 1 31.25 0 . 2
          2 1 2  80 29.27 2 0  5.15  3.081822      1.1970087 1 0  5.15 0 1 .
          1 2 2  80 26.31 2 1 39.54 2.9742236        .979152 1 1 39.54 0 . 2
          2 2 2  70   .97 2 1  1.41  .9898983     -1.1915276 1 1  1.41 0 . 2
          1 1 2  80   .19 1 0 11.51  .5748897       -.715325 1 0 11.51 0 1 .
          1 1 2  90   .04 2 0 31.67  .3419952     -1.2266303 1 0 31.67 0 1 .
          1 2 1  90  9.24 2 0 26.85 2.0984116       .3409153 1 0 26.85 0 . 2
          2 1 2  90   2.5 2 1  9.77  1.357209     -.29002926 1 1  9.77 0 1 .
          2 2 1  80 24.41 2 0 39.54  2.900832       .8271479 1 0 39.54 0 . 2
          1 1 2  80   .63 2 1 16.92  .8572619       -.948939 1 1 16.92 0 1 .
          2 3 1  90   .48 1 0 54.43  .7829735      -.4611238 1 0 54.43 0 . .
          2 1 1  80   .22 1 0 33.67  .6036811      -.7651462 1 0 33.67 0 1 .
          2 1 2  80  3.75 2 1  19.9 1.5536163      -.3311972 1 1  19.9 0 1 .
          1 3 2  80 11.83 2 1 22.03  2.278566       .3595195 1 1 22.03 0 . .
          1 2 2  90  2.47 2 0 17.57  1.351758      -.4057382 1 0 17.57 0 . 2
          1 1 2  80 12.08 2 1  7.25  2.294505        .488304 1 1  7.25 0 1 .
          2 2 2  80 11.51 2 1 14.62 2.2578328       .1841485 1 1 14.62 0 . 2
          1 1 2  40 22.87 2 1  3.38  2.838499 -1.5987212e-14 1 1  3.38 0 1 .
          2 2 2  80  4.77 2 0 67.38 1.6833436      -.3903406 1 0 67.38 0 . 2
          2 1 2  80  9.58 2 0 78.75   2.12384       .2390266 1 0 78.75 0 1 .
          1 2 2 100     4 2 0 52.23  1.587401      -.3947116 1 0 52.23 0 . 2
          1 1 2  80  7.59 2 1  4.56 1.9652325       .1590316 1 1  4.56 0 1 .
          2 3 1  70   .01 1 0 23.67 .21544346      -1.373971 1 0 23.67 0 . .
          1 2 2  80  6.93 1 0  10.1 1.9065334       .4274479 1 0  10.1 0 . 2
          1 2 2  70  3.63 2 0 32.82 1.5368644     -.56594896 1 0 32.82 0 . 2
          2 2 2  70  8.45 2 0 19.41  2.036818     -.14460793 1 0 19.41 0 . 2
          2 2 2  80 20.93 2 1 31.15  2.755855        .682171 1 1 31.15 0 . 2
          2 1 2  90  2.64 2 0 20.13 1.3820846      -.2651535 1 0 20.13 0 1 .
          1 1 2  80   .19 2 1 11.02  .5748897     -1.2313112 1 1 11.02 0 1 .
          2 3 2 100 24.91 2 0 19.74  2.920505       .9358049 1 0 19.74 0 . .
          1 2 2  80 31.74 2 0 57.25 3.1661804      1.1711087 1 0 57.25 0 . 2
          1 2 2  80  2.39 1 0 73.74  1.337004     -.14208163 1 0 73.74 0 . 2
          1 2 2  90  7.26 2 0 49.05 1.9363278       .1788315 1 0 49.05 0 . 2
          1 2 2 100  9.66 2 0 39.25 2.1297357      .14762308 1 0 39.25 0 . 2
          1 2 1  70  2.94 1 0  1.54 1.4325697      -.1542574 1 0  1.54 0 . 2
          1 1 2  80 15.45 2 1 46.16 2.4906316       .6844307 1 1 46.16 0 1 .
          1 3 2  90  1.82 2 0 47.11  1.220929      -.4605418 1 0 47.11 0 . .
          2 1 1  90 30.41 2 0  1.18 3.1213236      1.4740855 1 0  1.18 0 1 .
          2 1 2  80   .16 2 1 20.69  .5428835       -1.34193 1 1 20.69 0 1 .
          2 1 2  80 19.81 2 1  6.39 2.7057946       .8209811 1 1  6.39 0 1 .
          2 2 2  90   2.5 2 0 32.82  1.357209         -.4789 1 0 32.82 0 . 2
          2 2 2  90  2.02 1 0 42.07  1.264107     -.05601578 1 0 42.07 0 . 2
          2 3 1  80   .11 2 0  13.9   .479142      -1.518517 1 0  13.9 0 . .
          end
          label values sex sex
          label def sex 1 "Female", modify
          label def sex 2 "Male", modify
          label values diagnosis diagnosis
          label def diagnosis 1 "Glioma", modify
          label def diagnosis 2 "Meningioma", modify
          label def diagnosis 3 "Other", modify
          label values loc loc
          label def loc 1 "Infratentorial", modify
          label def loc 2 "Supratentorial", modify
          label values stereo stereo
          label def stereo 1 "SRS", modify
          label def stereo 2 "SRT", modify

          Comment


          • #6
            This is one way, by re-declaring your survival data with the exclusion criterion. Then you can re-run the same logrank test command again.

            Code:
            stset time, fail(status==1) if(diagnosis!=2)
            sts test diagnosis, logrank

            Comment


            • #7
              Leonardo, thank you so much, that was exactly what I needed. I tried the if commands on the test but failed, now I see that they were necessary during the first stage. Thanks a lot!

              Comment


              • #8
                You’re welcome. They do work with the test command in the usual way, but when dealing with survival data, applying the filtering at the declaration step is always safe.

                Comment

                Working...
                X