Announcement

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

  • graphing splines

    Hi
    I'm learning on splines. Trying to establish if my spline model is better than my 'orginal' model - which has showed non linear effects with LOESS

    Code:
     
     //Cubic spline model (less restrictive model) stcox cspline* var1 var2 var3 estimates store m1  // Linear model ('more restrictive' model) stcox var1 var2 var 3 estimates store m2  // LR test to compare (m2 nested in m1) lrtest m1 m2
    However I would like to plot a graph as shown in post 12 - can anyone help with the code? As I would not only like to use LR test but graphically visualise it.
    Also, I would then like to test for interactions,between var2#var3.

    What is your expert advice after determining if my spline model is better or not from the LR test - For example, let's say the cubic model is better, should I then test for interactions after testing the cubic model ?
    I would use the code below.

    Code:
     
     //Cubic spline model (less restrictive model) stcox cspline* var1 var2 var3 estimates store m1  // Interaction model  stcox var1 var2 var3 var2#var3 estimates store m2  // LR test to compare (m2 nested in m1) lrtest m1 m2



    Source: https://www.statalist.org/forums/for...ood-ratio-test
Working...
X