Announcement

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

  • Restricted Cubic Spline Analysis

    Dear all ,
    I am working with a large data-set of 6000 subjects.
    I would like to perform Restricted Cubic Spline analysis to calculate the hazards ratio's for an event (in this case stroke) along an entire spectrum of 1 continuous variable.

    I was able to place knots according to 5 percentiles for this continuous variable, however the calculated hazards ratio's seems way off?
    Could anybody help me with what I am doing wrong? Also, how do you draw a graph coming from this if the results would have been correct?

    This is the code I am currently using....
    rc_spline MV_MeanGradient, nknots (5)
    stset T2CVA_sensorMVsurgWithout0, failure(outcome_cva==1)
    stcox _S*


    many thanks in advance!

  • #2
    anyone?

    Comment


    • #3
      first, we have no idea what you mean by "seems way off" - please read and follow the advice in the FAQ

      second, the official -mkspline- is based on, among other user-contributed commands, the -rc_spline- command that you used and you should probably switch to it

      Comment


      • #4
        Thank you Rich!
        Code:
        stset T2CVA, failure(outcome_cva)
        rc_spline MV_MeanGradient, nknots (5)
        stcox AgeAtStudy female htn diabetes ckd_stage3orabove cad _S*
        Click image for larger version

Name:	test.jpg
Views:	1
Size:	33.7 KB
ID:	1582407



        The Mk spline code results in the same knots.
        However, the jump going from knot 1 to 2 to 3 to 4 makes no sense to me.

        thanks in advance,

        Comment


        • #5
          Originally posted by seb df View Post
          the jump going from knot 1 to 2 to 3 to 4 makes no sense to me.
          For insight, try
          Code:
          generate double place_holder = rnormal()
          regress place_holder c.(AgeAtStudy female htn diabetes ckd_stage3orabove cad _S*)
          estat vif
          and, yes, regress is intended.

          See also the helpful comments on the topic at this Web page from another member of this list.

          Comment


          • #6
            Thank you Joseph for your kind reply.
            I have attached the results.

            You were correct, VIF's have exploded.
            I have carefully read your attached web page (first it is stated multi-coll is not a problem but Maarten Buis suggests to use B-splines)?
            What do you recommend (and how to perform this)?

            thank you in advance
            Click image for larger version

Name:	coll.jpg
Views:	1
Size:	94.8 KB
ID:	1582452

            Comment


            • #7
              Hi, following up on the previous posts.
              Is there anybody who could help me in the analysis? (basically I would like to draw a curve with Hazard ratio on the Y axis for an entire spectrum of 1 variable on the X-axis (in this case MV_MeanGradient)
              that's why initially I opted for restricted cubic spline analysis, though I understand this may be wrong considering multi-collinearity exploded...

              thank you in advance

              Comment


              • #8
                Have you tried Maarten's recommendation, e.g., B-splines?

                You could also look into reducing the number of knots to see whether that helps, if you're going to stick with restricted cubic splines.

                You could also try centering the mean gradient variable and using a low-order polynomial fit, say, quadratic or cubic. Stata's factor variable notation comes in handy for this.

                Comment


                • #9


                  thank you for your reply.
                  I tried reducing the number of knots but didn't help.
                  I have read & installed the B-splines package for stata 12.1 by Roger Newson.

                  However, still stuck at producing a curve with HR or logg HR on y-axis.

                  * knotted variable= MV_MeanGradient
                  * outcome variable = outcome_cvaIFnoMVPbefore

                  Code:
                  bspline, xvar(MV_MeanGradient) knots(2 3 6 10 15) p(3) gen(MV_MG)
                  regress outcome_cvaIFnoMVPbefore MV_MG*, noconstant
                  predict MV_MG
                  Is this correct? or should I use stcox instead of regress?
                  What's the next step to produce a curve with HR on y axis along a spectrum of the x-variable (in this case MV_MeanGradient)

                  thank you in advance

                  Comment

                  Working...
                  X