Dear Statalist members,

Recently I did a Cox regression with restricted cubic spline (mvrs) in order to graph the non-linear association between hazard ratio and my Xvar1.

Although the graph showed exactly an U-shaped association, the reviewer requied a test for non-linearity (which is actually a P-value in most articles, as far as I have learnt).

Is there any code to test such hypothesis in Stata? Based on my knowledge, it seems like what I am testing is whether the coefficient for cubicly transformed Xvar (Xvar_0, Xvar_1, Xvar_2) is equal to 0 (see the results below). Is that enough for proving the non-linearity?

Thx a lot.


Code:
 xi: mvrs stcox Xvar age sex stemi hbp dm hf_2 pci_his ldl crea i.culp timi_0 d2btime thrombo iabp tiro asp

Final multivariable spline model for _t
------------------------------------------------------------------------------
    Variable |    -----Initial-----          -----Final-----
             |   df     Select   Alpha    Status    df    Knot positions
-------------+----------------------------------------------------------------
         Xvar |    4     1.0000   0.0500     in      3     [lin] 2.79 12.07
         age |    4     1.0000   0.0500     in      1     Linear
         sex |    1     1.0000   0.0500     in      2     Linear
       stemi |    1     1.0000   0.0500     in      2     Linear
         hbp |    1     1.0000   0.0500     in      2     Linear
          dm |    1     1.0000   0.0500     in      2     Linear
        hf_2 |    1     1.0000   0.0500     in      2     Linear
     pci_his |    1     1.0000   0.0500     in      2     Linear
         ldl |    4     1.0000   0.0500     in      1     Linear
        crea |    4     1.0000   0.0500     in      1     Linear
    _Iculp_2 |    1     1.0000   0.0500     in      2     Linear
    _Iculp_3 |    1     1.0000   0.0500     in      2     Linear
    _Iculp_4 |    1     1.0000   0.0500     in      2     Linear
    _Iculp_5 |    1     1.0000   0.0500     in      2     Linear
      timi_0 |    1     1.0000   0.0500     in      2     Linear
     d2btime |    4     1.0000   0.0500     in      1     Linear
     thrombo |    1     1.0000   0.0500     in      2     Linear
        iabp |    1     1.0000   0.0500     in      2     Linear
        tiro |    1     1.0000   0.0500     in      2     Linear
         asp |    1     1.0000   0.0500     in      2     Linear
------------------------------------------------------------------------------


Cox regression -- Breslow method for ties
Entry time _t0                                    Number of obs   =       3980
                                                  LR chi2(22)     =     235.83
                                                  Prob > chi2     =     0.0000
Log likelihood = -935.89368                       Pseudo R2       =     0.1119

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       Xvar_0 |   .0350324    .087242     0.40   0.688    -.1359588    .2060236
       Xvar_1 |  -.1742873    .077077    -2.26   0.024    -.3253555   -.0232192
       Xvar_2 |   .2408546   .0900958     2.67   0.008     .0642702    .4174391
         age |   .0468714   .0086012     5.45   0.000     .0300133    .0637295
         sex |   -.513448   .1966388    -2.61   0.009     -.898853   -.1280431
       stemi |  -.2819774   .2841655    -0.99   0.321    -.8389316    .2749769
         hbp |   .3275591   .2001628     1.64   0.102    -.0647527    .7198709
          dm |   .0735698   .1830752     0.40   0.688    -.2852511    .4323906
        hf_2 |   1.216276   .1854233     6.56   0.000     .8528525    1.579699
     pci_his |   .3591419   .2500795     1.44   0.151    -.1310049    .8492887
         ldl |   -.042943   .1036864    -0.41   0.679    -.2461646    .1602787
        crea |   .0104941   .0021757     4.82   0.000     .0062299    .0147584
    _Iculp_2 |   .7382852   .3876987     1.90   0.057    -.0215903    1.498161
    _Iculp_3 |   .9029866   .3816996     2.37   0.018     .1548691    1.651104
    _Iculp_4 |     1.6113     .47715     3.38   0.001     .6761029    2.546497
    _Iculp_5 |   1.771119   .7053499     2.51   0.012     .3886584    3.153579
      timi_0 |   .4584349   .2198601     2.09   0.037     .0275171    .8893528
     d2btime |   1.42e-06   9.61e-06     0.15   0.883    -.0000174    .0000203
     thrombo |   .0092184   .2040014     0.05   0.964    -.3906169    .4090538
        iabp |   .6062582   .2079598     2.92   0.004     .1986645    1.013852
        tiro |  -.0185661   .2624105    -0.07   0.944    -.5328812     .495749
         asp |  -.1059745   .4885523    -0.22   0.828    -1.063519    .8515703
------------------------------------------------------------------------------
Deviance: 1871.787.

. testparm Xvar_*

 ( 1)  Xvar_0 = 0
 ( 2)  Xvar_1 = 0
 ( 3)  Xvar_2 = 0

           chi2(  3) =   10.60
         Prob > chi2 =    0.0141

Array