Announcement

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

  • Interaction terms with stcox model and LR tests

    Hello there. I'm learning interaction effects in survival models in semi-parametric tests.

    I would like to find the best model to fit my data before then testing PH for COX model (haha if my COX does not satisfy PH I have to do everything again with the parametric tests *facepalm*)
    However, I have assessed interaction effects with my data (which is a large dataset consisting of 2 million observations). I am however practising with dummy data for now. Here's a dummy data set below

    My question is whether :
    1. I can perform a LR comparing all INTERACTIONS in the model (I have 32 interactions) to a Model with 0 interactions - thus trying to understand if the interaction model is better than the non-interaction model

    OR

    2. Perform a LR comparing one model at a time, adding one interaction term consecutively therefore I will have 33 models (all 32 interactions + the model with no interactions) ?

    The reason I ask is all books give examples showing that 1 interaction model is significant therefore comparing an Interaction model to a No interaction model but it would only have 1 interaction term. What happens if you have more than 1?

    Perhaps I'm making it too complex but here's an example of what I'm trying to ask

    Here is a sample of the data:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(tx ct1 ct2 ct3 ct4 survt perf dd age priortx status)
    1 0 0 0 1  72 60  7 69  0 1
    1 0 0 0 1 411 70  5 64 10 1
    1 0 0 0 1 228 60  3 38  0 1
    1 0 0 0 1 126 60  9 63 10 1
    1 0 0 0 1 118 70 11 65 10 1
    1 0 0 0 1  10 20  5 49  0 1
    1 0 0 0 1  82 40 10 69 10 1
    1 0 0 0 1 110 80 29 68  0 1
    1 0 0 0 1 314 50 18 43  0 1
    1 0 0 0 1 100 70  6 70  0 0
    end
    Code:
    //Set time 
    stset survt, failure(status == 1)
    
    //Univariate analysis on categorical models
    sts test ct1, logrank //0.08
    sts test ct2, logrank //keep
    sts test ct3, logrank //keep
    sts test ct4, logrank //keep
    sts test tx, logrank  //STILL KEEP 
    sts test perf, logrank  //still keep
    sts test priortx, logrank //still keep 
    
    
    //Cumulative variables 
    stcox age, nohr  //still keep desp 0.4
    
    //CHECK INTERACTIONS 
    stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx i.priortx#c.age
    
    Let us assume these are the significant Interactions: 
    ct1#perf
    ct4#priortx
    Should I perform LR test with

    ​​​​​​​
    Code:
    Model 1: All interactions within the model which would mean
    stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx i.priortx#c.age ct1#perf ct4#priortx 
    
    COMPARED TO 
    
    Model 2: //No interaction model 
    stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx 
    
    
    OR should I perform a LR with one interaction model at a time 
    
    //1 interaction 
    quietly: stcox stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx i.priortx#c.age
    eststo model1
    
    //2 interactions 
    quietly: stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx i.priortx#c.age ct1#perf ct4
    eststo model2
    //ALL three interactions together
    quietly: stcox c.age i.ct1 i.ct2 i.ct3 i.ct4 i.tx i.perf i.priortx i.priortx#c.age ct1#perf ct4#priortx 
    eststo model3
    
    estout model1 model2 model3 , eform stats(n chi2 bic, star(chi2)) prehead("Hazard Ratios")
    ​​​​​​​

  • #2
    Or perhaps I could create a loop ? To make backward selection easier ?

    Comment

    Working...
    X