Announcement

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

  • Problem with predicting survival probabilities from stpm2 model with TVC in external data

    I have built a prognostic model using stpm2 which includes a tvc (all covariates in model are centered, Sb variables are restricted cubic splines). The model is intended for clinical use which will involve generating survival probabilities at 2 and 5 years for individual patients.
    Is it possible to calculate/predict survival probabilities in external data for a stpm2 model including a tvc?
    I am having problems re-creating the tvc element of the model.

    Many thanks in advance.
    Kind regards
    Anita

    stset survtime, failure(iT==1) scale(12) id(ID)
    stpm2 Pred_A_cent Sb1 Sb3 Sb2 Sb4 Pred_Hb_cent , tvc(Pred_Hb_cent) knotstvc(Pred_Hb_cent 5) scale(normal) df(3) noorthog

    Coefficients from output table -
    xb
    Pred_A_cent -0.0223022 .
    Sb1 -0.0196823
    Sb3 0.0813105
    Sb2 -0.0655064
    Sb4 -0.0227443
    Pred_Hb_cent 0 .0171128
    _rcs1 0 .247728
    _rcs2 0.14239
    _rcs3 -0.3269927
    _rcs_Pred_Hb_cent1 0. 0021463
    _rcs_Pred_Hb_cent2 0.0003087
    _cons -2.574488


  • #2
    Yes, it's possible to predict survival probabilities in external data for a stpm2 model including a tvc. Here's a link to an example doing just that.

    http://pauldickman.com/software/stat...out-of-sample/

    You haven't shown code illustrating your attempts at prediction, so I can't say what the problem is, but hopefully the linked example will help.

    Comment


    • #3
      Thank you so much for the link Paul, very helpful. I can now externally validate my model. Would I need to follow the same process to generate probabilities if I wanted to incorporate the model into an app/website for use by doctors in clinical practice?

      Comment


      • #4
        You could just code the formulas in the predict command into your website/app. Have a look at https://interpret.le.ac.uk/

        I didn't do any of the coding (see the 'about' section for the names and contact details of those who did) but the predictions are based on the estimates from -stpm2-. Essentially, the -predict- commands are coded in javascript.

        Comment


        • #5
          Hi Paul Dickman , I am trying to make an out of sample prediction using a stpm2 model that has two tvc's, both factor variables (which I have made into dummies so stpm2 can run). However, following the link you gave, I fail to create the rcs for each of the dummies (presumably as they just have a 0 or 1 value). Is there a way around this?

          Comment


          • #6
            Specifically, I realise the issue is that, after using the model originally specified as, for instance,
            Code:
            stpm2 female age, df(2) tvc(female) dftvc(2) scale(h)
            , when I have the out of sample dataset, I am trying to :
            Code:
            predict lp, xbnobase
            in order to then calculate the c-index model performance metric. However, I get the following error code: "_rcs_female1" not found.

            Comment

            Working...
            X