Announcement

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

  • Hazard ratios after adjustrcspline, or a similar method for splines after Cox regression

    Hi! I apologise if this question is readily answered elsewhere. However, i feel i have combed the web quite extensively now.

    Purpose: I wish to create a Cox spline with HRs on the y-axis and a continuous predictor of interest on the x-axis.

    How doi intend to do it, and what have i tried? I have tried to use adjustrcspline. However, i am unsure as to how i pass the proper link functon to adjustrcspline to generate a graph of what i want. For exmaple in:

    "

    mkspline2 dot = age , cubic nknots(3)
    stcox dot*
    adjustrcspline, custominvlink( ? )

    "

    What do i specify to graph hazard ratios and to set the reference?

    I am a medical student and thus not a statistician: i therefore apologise if my questions seem ignorant, and would very much appreciate if you would explain any mathematical operations/presumptions if needed.

    I have generated graphs following logistic regression using " predict x, xb" and " predict x, stdp" , converting these to odds by exp(x) and dividing these by a reference to generate odds ratios. I am interested in generating similar graphs following Cox so that i may utilise survival analysis. However, it appears to be quite tricky.

    The graph i have attached in this post is generated with postestimation after logistic with definition of a reference value. I want to create something similar using Cox.



    Thank you so much!


    Click image for larger version

Name:	log.png
Views:	1
Size:	857.5 KB
ID:	1426186

  • #2
    dear friend, I only see your message now; I'm sorry that no one has answered (it happened to me too): try the link below, where you will probably find the solution of your problem
    http://biostat.mc.vanderbilt.edu/wik...per_22Apr16.do

    Comment


    • #3
      Interesting question, indeed. Because as of now (five yrs later), I am still unaware of any publicly available solution for this in STATA. Unfortunately, the link posted above is dead now., would have been exciting to have taken a look at this do flile.

      Comment


      • #4
        Solved? It has been 6 years.

        Comment


        • #5
          Figured it out.

          Code:

          Code:
          import excel "~/example.xlsx", firstrow
          
          
          
          
          stset time, failure(outcome)
          
          
          
          
          mkspline ageYs = ageY, cubic nknots(3) displayknots
          
          
          
          
          matrix knots= r(knots)
          
          
          
          
          stcox ageYs* predictor2 predictor3 predictor4
          
          
          
          
          xbrcspline ageYs, values(18(1)90) ref(20) matknots(knots) eform generate(Age HR LCI UCI)
          
          
          
          
          twoway (line LCI UCI Age, sort lc(black black) lp(- -)) (line HR Age, sort lc(black) lp(l)), scheme(sj) ytitle(Hazard ratio) xtitle(Age (years))

          Comment


          • #6
            Hi Tom,
            I'm using the above-mentioned code for a restricted cubic analysis. Eventually, STATA gave me a graph.
            So, I'm confused about the P-value for non-linearity. How to get the P-value for non-linearity?

            Comment


            • #7
              Originally posted by Mohammadreza Moradi View Post
              Hi Tom,
              I'm using the above-mentioned code for a restricted cubic analysis. Eventually, STATA gave me a graph.
              So, I'm confused about the P-value for non-linearity. How to get the P-value for non-linearity?
              Hi, Dr. Moradi

              I didn't think of this question when I was estimating a RCS. I am interested in your question and can you describe your issue more detail? Thanks

              Comment

              Working...
              X