Announcement

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

  • Testing the linearity assumption in a Cox model

    Hello,

    I am running a Cox model to examine the effect of a treatment ("treat" - a binary variable) on the risk of death. One of the predictors is a continuous variable (age). However, I do not know how to test if the linearity assumption for age is fulfilled. I have tried doing a search, but without luck. This is my model:
    stset t2dth, failure(c4dth==1)
    stcox treat age, efron


    Thanks a lot in advance.

    Bill

  • #2
    Bill:
    welcome to this forum.
    You may want to take a look at cox model - Cox PH linearity assumption: reading martingal residual plots - Cross Validated (stackexchange.com).
    That said, you may want to check non-linearity assumption via:
    Code:
    stcox treat c.age##c.age, efron
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you so much for your shift response! I have now made a figure where I have plotted the observed cumulative martingale residuals against the values of the explanatory variable.
      In addition, I have run the code provided by you. The P-value for the ineraction term between age is highly significant - does that mean that the linearity assumption is not met?

      Comment


      • #4
        Bill:
        yes, it means that (as it is often the case with -age-).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X