Announcement

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

  • survival analysis

    Can I hope for the answer of someone who already faced with this question.
    I'm not wait for general directions to see there or here. I already looked there or here and ... did not understand... (including prof. Jenkins explanations here).
    I ask only to indicate to me a concrete example (!) suitable for my case.

    My variables (this is model example) are:
    id patient
    event time (survival time, months)
    event (1 - yes, 0 -censore)
    age (as a covariate)
    sex (as a covariate)
    pain1 (1 - yes, 0 - no, the patient's condition is assessed in the 1st time point)
    pain2 (1 - yes, 0 - no, 2nd time point)
    pain3 (1 - yes, 0 - no, 3rd time point)
    (pain - it is time-dependent covariate! patient either has pain, or has not it)

    Pls, note: variables columns go one after another.

    Conditions:
    Left-censored data, discrete time, Cox-proportional hazards mode.
    (No, I do not want to check model. I need at least some concrete example. Without additional questions to my data!!)

    I just want to see the significance level p of all three covariates. Nothing more!
    (and, IF POSSIBLE, without any data conversions).

    Is there a concrete example with such a data structure (that I could just repeat such code)? P.S. Instead of a binary variable "pain", example may contain a continuous variable, for example, "temperature". Thank you for reading to the end ))
    Last edited by Ted Turov; 22 Dec 2017, 07:33. Reason: survival analysis

  • #2
    I prefer to work with menu dialog box. So, after
    stset time, failure(event==1) and db stcox, I entered data:

    Model tab:
    Independent var: age, sex
    Strata id: id

    Time varying tab:
    Time varying covariates pain1 pain2 pain3
    Multiplier for time-varying: _t (automatically)

    Submit
    as a result, such a team was baked:
    stcox age sex, strata(id) tvc(pain1 pain2 pain3) texp(_t):

    and ... something wrong turned out
    Last edited by Ted Turov; 22 Dec 2017, 08:49.

    Comment


    • #3
      Ted,

      It's not clear what you're asking. Do you want an example dataset? If so, then if you read the manual for -stcox-, there are a number of example datasets.

      Or do you want an example of how to do survival analysis with your data? It's not clear what data you have, so this will be hard, and most people aren't familiar with the menus, and some of what you want to achieve may be very difficult or impossible without programming. In particular, it looks like you have a time-varying covariate. I can tell you that it looks a lot like you specified the -tvc- wrongly. -tvc- is for variables that vary continuously with respect to time - age, for example. You have pain measured at 3 discrete points. It looks like you're trying to infer the effect of age, sex, and pain on survival. I haven't worked with survival data in a while, but I strongly suspect your data are wide, and you are looking for something more like a long format. You need to reshape the data. Nobody can give you any worthwhile advice on how to do that without seeing an example. You can make up an example if you want - take your data, select the first 20 cases, then erase everything and randomly input survival times and covariates.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Of course, I'm talking about cox-regression analysis with time-dependent covariate. I need an indication of the code that fits my data structure. And I'm appealing to those who are dealing with this! Sorry and thanks!
        Last edited by Ted Turov; 22 Dec 2017, 10:01.

        Comment


        • #5
          Hi Ted,

          As a quick distinction to ensure we are using the same terminology -- time-dependent effect means the effect of the covariate on survival depends on time, while time-varying covariate means that the value of a covariate changes over time. Thus, a covariate like 'pain' in your data set is time-varying, but may or may not have time-dependent effects. If we agree on this terminology we can move forward.

          I believe Weiwen has provided the solution for your question, which is to reshape your data from wide to long (Stata command reshape) and then set the data as multiple-record per subject (MRPS) format and proceed with a Cox PH model. For more guidance on reshaping your data see -help reshape- and for more information on MRPS see -help stset-.
          Last edited by Matt Warkentin; 22 Dec 2017, 10:25.

          Comment


          • #6
            1. OK! I will call: "time-varying covariate". (Especially since I'm not talking about EFFECT nowhere ... the goal of cox-regression is just to find out if this EFFECT exists or not).

            2. Of course I read about the need to convert data, but I did not understand how. That's why I ask your answer in the form of a concret example. You can not point to a concret example? In any case, I thank you for patience and benevolence!

            P.S. I give a link to my (model) data (time-varying.dta): <redacted>
            Maybe you will create this particular code example (then you can give a link to it for others ignoramus like me).

            PP.S. When I trying to attach here ("Upload Attachments") my file (time-varying.dta) I got a message: "This is not a valid image file". I can attach here pictures only?!?!
            Last edited by Pete Huckelba (StataCorp); 23 Dec 2017, 05:28. Reason: Removed link to confidential data

            Comment


            • #7
              Ted, it sounds like English is not your native language, you are trying to convey something that we are not understanding, and you are getting frustrated. I can understand that, but if your frustration comes through in your posts, people are not going to want to help.

              You asked elsewhere, what are code delimiters? Look for the # button on the control panel when you submit a post. It's in between the " (double quote) button and the <> button. Code delimiters will make code look like this:

              Code:
              ssc install dataex
              This is much easier for us to read. If you type that into the command line, Stata will install a user-written command called dataex (unless you already have the latest version of Stata 15, which has this installed already). That command can create a sample dataset, and it will even type text that you can copy from Stata and paste on the forum. I suggest you install it - I took a risk and downloaded your .dta file, but others may not be willing to risk this (it's not you, it's the world we live in). In any case, here are your data. I listed the first 15 observations and omitted a few variables. And if anyone is able and willing to help you, they can copy that block of code, paste it into the command line, and they instantly have a sample of your data.

              Code:
              * Example generated by -dataex-. To install: ssc install dataex
              clear
              input str27 id byte(time pain1 pain2 pain3 group)
              "Patient 1"   22 0 1 0 1
              "Patient 2" 33 0 0 0 1
              "Patient 3"     20 0 0 0 1
              "Patient 4"       28 0 0 1 1
              "Patient 5"          18 0 1 0 1
              "Patient 6"              17 0 0 1 1
              "Patient 7"        14 0 1 1 1
              "Patient 8"           8 1 0 0 1
              "Patient 9"            3 1 1 1 1
              "Patient 10"    3 1 0 0 1
              "Patient 11"       13 0 1 0 1
              "Patient 12"              12 0 0 0 1
              "Patient 13"            14 0 0 0 1
              "Patient 14"        10 0 0 1 1
              "Patient 15"           6 0 1 0 1
              end
              Now that I see this, I can tell you this. Do you know the time at which the 3 follow-up observations were given? Did the patients get pain measurement 1 at the same analysis time? If so, and you know this time, then you can reshape the data like this. For example, imagine pain1 was administered at time = 1. The problem is, because you already have time in there, this is not an easy reshape. I don't actually have a good idea how to pull this off. If you meant for pain1, pain2, and pain3 to correspond to pain measurements at those time points, then the data were badly shaped to begin with. I would go back to the person who produced them, unless anyone here has better ideas.

              If the patient's pain measurements were at different times, then this will be even more tricky to reshape. If you don't know what time the pain measurements were administered at all, then frankly I can't help you at all.

              Last, in my experience, it's probably better to assign number IDs to people. I assume all those names are fictional, but the point remains.
              Last edited by Pete Huckelba (StataCorp); 23 Dec 2017, 05:38. Reason: Mask sensitive data
              Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

              When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

              Comment


              • #8
                Urgent! Ng, see the private message

                Comment


                • #9
                  Originally posted by Ted Turov View Post
                  Urgent! Ng, see the private message
                  Ted, I flagged the post to the mods, and they'll delete or censor it. Unfortunately, we aren't able to edit our posts after a certain time. I should have thought about this, but you also bear some responsibility not to post identifiable information on the web! A lot of responsibility, in fact! Personally, I'm done helping you.
                  Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

                  When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

                  Comment

                  Working...
                  X