Announcement

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

  • adjustrcspline error

    I'm trying to fit an stcox model with cubic splines to see the association between mortality and ratiopasit where ratiopasit is the ratio of PA (mins) and sitting time (hours).When I use the adjustrcspline command I get an error.

    Code:
    mkspline2 ssratiopasit =ratiopasit, cubic nknots (5) displayknots
    mat ratiopasitknots=r(knots)
    matrix list ratiopasitknots
    ratiopasitknots[1,5]
    knot1 knot2 knot3 knot4 knot5
    ratiopasit 0 1.5155344 4.496788 10.675714 35.928143

    Code:
    stcox ssratiopasit1 ssratiopasit2 ssratiopasit3 ssratiopasit4 drage_05 i.sex_05 i.gq5_edu_05_recoded i.smokstat_05recoded i.gq3_marr__05_recoded i.no_comorbid_recoded waist_05
    -------------------------------------------------------------------------------------------
    _t | Haz. ratio Std. err. z P>|z| [95% conf. interval]
    --------------------------+----------------------------------------------------------------
    ssratiopasit1 | .8297227 .0597145 -2.59 0.009 .7205641 .9554178
    ssratiopasit2 | 1609080 1.18e+07 1.94 0.052 .8802037 2.94e+12
    ssratiopasit3 | 1.96e-10 2.35e-09 -1.86 0.062 1.23e-20 3.144156
    ssratiopasit4 | 4733.167 24257.47 1.65 0.099 .2054684 1.09e+08
    drage_05 | 1.128093 .0040805 33.32 0.000 1.120124 1.136119
    |
    sex_05 |
    female | .6823007 .0531652 -4.91 0.000 .5856657 .7948805
    |
    gq5_edu_05_recoded |
    high school or more | .9878815 .0885629 -0.14 0.892 .8286959 1.177645
    |
    smokstat_05recoded |
    ex-smoker | .4832277 .0583604 -6.02 0.000 .3813734 .6122845
    non-smoker | .4035807 .0482261 -7.59 0.000 .3193122 .5100882
    unknown category/missing | .4148576 .0792575 -4.61 0.000 .2852851 .6032801
    |
    2.gq3_marr__05_recoded | 1.289657 .0951568 3.45 0.001 1.116011 1.490321
    |
    no_comorbid_recoded |
    1 | 1.227457 .1227486 2.05 0.040 1.008984 1.493236
    2 | 1.45518 .1514774 3.60 0.000 1.186617 1.784526
    3 | 1.782304 .1993574 5.17 0.000 1.431435 2.219176
    |
    waist_05 | 1.005195 .0028721 1.81 0.070 .9995814 1.01084
    -------------------------------------------------------------------------------------------

    Code:
    adjustrcspline
    all variables created in the last call to mkspline2 must be
    independent variables in the last estimation command
    r(198);

    I've looked for this error on Statalist. Since the function (adjustrcspline) is calling values from e() estimated from the equation, these matrices should not be empty.
    . matlist e(b)

    | 1b. 2.
    | ssratio~1 ssratio~2 ssratio~3 ssratio~4 drage_05 sex_05 sex_05
    -------------+-----------------------------------------------------------------------------
    y1 | -.1866637 14.29117 -22.35132 8.46235 .1205287 0 -.3822848

    | 1b. 2. 1b. 2. 3. 4. 1b.
    | gq5_edu~d gq5_edu~d smoksta~d smoksta~d smoksta~d smoksta~d gq3_mar~d
    -------------+-----------------------------------------------------------------------------
    y1 | 0 -.0121925 0 -.7272673 -.9073788 -.8798199 0

    | 2. 0b. 1. 2. 3.
    | gq3_mar~d no_com~ed no_com~ed no_com~ed no_com~ed waist_05
    -------------+------------------------------------------------------------------
    y1 | .2543762 0 .2049448 .3751297 .5779068 .0051814


    Can someone shed light on why do I still get this error. Thanks in advance.
    Last edited by parneet sethi; 30 May 2022, 19:22.

  • #2
    You should have gotten a different error message:

    Code:
    last estimation command (cox) was not recognized
    specify the link() or custominvlink() option to manually specify the link function
    r(198);
    Regardless, there is a bigger problem here: what is your prediction going to mean. Remember that Cox regression is semi-parametric in the sense that it does not estimate the baseline hazard function. For predictions to have a meaning like the "hazard of getting the event", you need the baseline hazard function. This is the reason why Cox regression is not supported by adjustrcspline.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X